Vehicle Brakes
by Neil Marshall · in Torque Game Engine · 06/20/2003 (11:52 am) · 6 replies
How do I get the vehicle to brake? I don't want it to slow down and reverse. I just want to stop.
Is there something I can do to the mv* variables or do I have to program a new one?
Is there something I can do to the mv* variables or do I have to program a new one?
#2
if (curMove.y < 0)
curMove.y = 0;
and that works, but when I ran into a wall I suddenly found out just how useful a reverse can be :) I think I'll need to add something to support a brake and reverse. I don't know how I'm going to do that though.
06/20/2003 (12:07 pm)
Yeah I added a simpleif (curMove.y < 0)
curMove.y = 0;
and that works, but when I ran into a wall I suddenly found out just how useful a reverse can be :) I think I'll need to add something to support a brake and reverse. I don't know how I'm going to do that though.
#3
Add a variable mBraking to the vechicle. If the user presses the back button while curMove.y is >0 then set mBraking to true and only allow it to hit zero, then set mBraking to false. If the user presses the back key while the vechicle is stopped mBraking isn't set and you can back up. You've just got to make sure you do when the button is pressed not WHILE it's pressed.
That's assuming you want to keep the same key for break and reverse...
06/20/2003 (12:21 pm)
Here's a thought...Add a variable mBraking to the vechicle. If the user presses the back button while curMove.y is >0 then set mBraking to true and only allow it to hit zero, then set mBraking to false. If the user presses the back key while the vechicle is stopped mBraking isn't set and you can back up. You've just got to make sure you do when the button is pressed not WHILE it's pressed.
That's assuming you want to keep the same key for break and reverse...
#4
For wheeled vehicles:
add in /fps/client/scripts/default.bind.cs
below: moveMap.bind( mouse, button0, mouseFire );
add:
edit /fps/client/scripts/config.cs
add:
edit your wheeledVehicle Datablock and change the brakeTorque value to a new value. Higher values for brakeTorque should produce a faster stop.
Now when you want to stop, just press the right mouse button.
06/20/2003 (12:39 pm)
Or just use the brakes that are already coded in the game.For wheeled vehicles:
add in /fps/client/scripts/default.bind.cs
function brakeTrigger(%val)
{
$mvTriggerCount2++;
}below: moveMap.bind( mouse, button0, mouseFire );
add:
moveMap.bind( mouse, button1, brakeTrigger );
edit /fps/client/scripts/config.cs
add:
moveMap.bind(mouse0, "button1", brakeTrigger);
edit your wheeledVehicle Datablock and change the brakeTorque value to a new value. Higher values for brakeTorque should produce a faster stop.
Now when you want to stop, just press the right mouse button.
#5
06/20/2003 (1:12 pm)
Beat me to it Labby ;)
#6
-- edited part
if anyone cares there are 4 lines of code in player.cc (Player::processTick) that, when commented out, stop it from dismounting when trigger 2 is set.
06/20/2003 (1:17 pm)
Triggercount2 appears to be working but now I have to figure out why it's dismounting when it hits 0.-- edited part
if anyone cares there are 4 lines of code in player.cc (Player::processTick) that, when commented out, stop it from dismounting when trigger 2 is set.
Torque 3D Owner Xavier "eXoDuS" Amado
Default Studio Name
Just a draft Idea... I haven't looked at the code myself. But that's what you should try doing