WheeledVehicle problem
by Richard Holmes · in Torque Game Engine · 08/14/2008 (3:12 am) · 4 replies
I am using a fps startup kit and have modified the default steering functions in default.bind.cs for the wheeled vehicle. When I start the game, the player is "a car" (the control obj), but the key bindings have no effect.
I tried moving the exec("default.bind.cs") right after the adding of the car... but still no effect.
What should I do?... i don't get it...
I tried moving the exec("default.bind.cs") right after the adding of the car... but still no effect.
What should I do?... i don't get it...
#2
function turnRight( %val )
{
$mvYawLeftSpeed = 0.4*%val;
////////////////////////it's the same as %mvYawLeftSpeed = %val ? $Pref::Input::KeyboardTurnSpeed : 0;
////////////////////////where keyboardTurnSpeed is .4
echo("turnRight val=" @ %val @ " mvYawLeftSpeed ="@$mvYawLeftSpeed);
}
Output:
turnRight val=1 mvYawLeftSpeed =0.4 //when i press
turnRight val=0 mvYawLeftSpeed =0 //when i release
the wheel is not going to its original state.
What is the variable that controls the angle of the steering wheels?
08/18/2008 (12:12 am)
Thanks Daniel, got the DeletePrefs, but my function still has no effect. When i press the turn key, it makes the turn value 0.4 and the wheel turns. When i release the key, the turn value is 0; so basically the wheel should go to its original state.function turnRight( %val )
{
$mvYawLeftSpeed = 0.4*%val;
////////////////////////it's the same as %mvYawLeftSpeed = %val ? $Pref::Input::KeyboardTurnSpeed : 0;
////////////////////////where keyboardTurnSpeed is .4
echo("turnRight val=" @ %val @ " mvYawLeftSpeed ="@$mvYawLeftSpeed);
}
Output:
turnRight val=1 mvYawLeftSpeed =0.4 //when i press
turnRight val=0 mvYawLeftSpeed =0 //when i release
the wheel is not going to its original state.
What is the variable that controls the angle of the steering wheels?
#3
$mvYawLeftSpeed is a script variable that gets read by the client code. This value is used to create a Move packet. (coded up and compressed form of the players input commands for the vehicle sent to the server for action.)
Look at the vehicle.cc or vehicle.cpp at the vehicle::updateMove method. This is where the move is received by the vehicle. The effect of $mvYawLeftSpeed gets transmitted via move->yaw which has effect on mSteering.x. Look in WheeledVehicle::updateForces to see how mSteering.x causes the front wheels to turn. When the wheels are angled to the wheels direction of motion, it causes the tire to create lateral forces. (Whew. Have fun! ;) )
-------
Above is the long and learning path.
The quick and lazy path is to do more forum searching and find threads discussing modifications to vehicle steering. There have been lots of ways to adjust how the script side feeds the steering code to implement various features. Find your favorite or a couple of them, implement them, and see if they do what you need.
08/19/2008 (8:09 pm)
This is a rather complicated area. It's a royal pain in the *beep* to trace through everything but well worth it in the end. Unfortunately, it is very hard to follow the command flow using code searches as it is buried cryptically in the torquescript integration with the engine. $mvYawLeftSpeed is a script variable that gets read by the client code. This value is used to create a Move packet. (coded up and compressed form of the players input commands for the vehicle sent to the server for action.)
Look at the vehicle.cc or vehicle.cpp at the vehicle::updateMove method. This is where the move is received by the vehicle. The effect of $mvYawLeftSpeed gets transmitted via move->yaw which has effect on mSteering.x. Look in WheeledVehicle::updateForces to see how mSteering.x causes the front wheels to turn. When the wheels are angled to the wheels direction of motion, it causes the tire to create lateral forces. (Whew. Have fun! ;) )
-------
Above is the long and learning path.
The quick and lazy path is to do more forum searching and find threads discussing modifications to vehicle steering. There have been lots of ways to adjust how the script side feeds the steering code to implement various features. Find your favorite or a couple of them, implement them, and see if they do what you need.
#4
Do a little more searching - I know there was definitely a resource that modded the steering to auto-centre if &maYaw is 0.
08/20/2008 (7:26 am)
Yeah, you'll want to modify vehicle steering. When you set $mvYaw, that's used to change the steering, not to set it. So when your steering is 0, you're actually changing the steering by 0 - whereas to centre the wheels to their default state, you'd want to add a negative change to them. Which is what you do when you steer the other direction.Do a little more searching - I know there was definitely a resource that modded the steering to auto-centre if &maYaw is 0.
Torque Owner Daniel Buckmaster
T3D Steering Committee