Flying Vehicles flying backwards.
by Max · in Torque Game Engine · 01/13/2008 (2:27 pm) · 9 replies
Hey there.
For some time I've been having trouble with my flying vehicles being able to fly backwards. You see, the jets on my aircraft are positioned on the back, making only forward thrusting possible.
However, when I press my 'backwards' key, the vehicle can go just as fast in reverse as it does forward.
I've tried many many resources on GarageGames and none of them worked correctly.
Is there any definition in the FlyingVehicle datablock that can prevent my aircraft from flying backwards? If so, which one is it? If not, how can I edit the engine to prevent negative thrust?
Thanks in advance.
For some time I've been having trouble with my flying vehicles being able to fly backwards. You see, the jets on my aircraft are positioned on the back, making only forward thrusting possible.
However, when I press my 'backwards' key, the vehicle can go just as fast in reverse as it does forward.
I've tried many many resources on GarageGames and none of them worked correctly.
Is there any definition in the FlyingVehicle datablock that can prevent my aircraft from flying backwards? If so, which one is it? If not, how can I edit the engine to prevent negative thrust?
Thanks in advance.
About the author
#2
01/14/2008 (5:26 pm)
Thanks Daniel. I'll try it out this weekend.
#3
01/14/2008 (6:03 pm)
Since I need this also, I will look at the source and edit the flying vehicle code this week to support MAX Retro thrust. (In your case, MAX Retro Thrust will be zero). I will post my changes here. just be a case of exposing an existing variable to the datablock. I'm at my real job right now, but I will check tonight.
#4
01/14/2008 (6:12 pm)
Would it not be easier just to turn off the ability to go backwards. Or just eliminating the bind key to backwards all togeather if theres no need to ever go in reverse. Seems going in and making a source code change is the long road to travel for this. Just my opinion though.
#5
Then you will want to go into the client/scripts/ directory and open up default.bind.cs and remove the following function.
function movebackward(%val)
{
$mvBackwardAction = %val * $movementSpeed;
}
You have now removed the backwards movement keys from the client.
----OR----
You could go on the server side under server/scripts/ and open the file player.cs and go down into the PlayerBody Datablock and set maxBackwardSpeed = 0
Now the player can not move backwards.
----------
The second way above allows you to retain the backwards movements for out of ship movement on space stations and such and then when the player gets into a vehicle you can just use the Vehicles Datablock and set its maxBackwardSpeed to 0 and the vehicle will not be able to move backwards but the player still can when not in the vehicle / spaceship.
01/14/2008 (6:18 pm)
To remove the backwards bind (if you never need reverse in the game) go into the client folder. Look for config.cs and remove the line "moveMap.bind(keyboard, "s", movebackward);"Then you will want to go into the client/scripts/ directory and open up default.bind.cs and remove the following function.
function movebackward(%val)
{
$mvBackwardAction = %val * $movementSpeed;
}
You have now removed the backwards movement keys from the client.
----OR----
You could go on the server side under server/scripts/ and open the file player.cs and go down into the PlayerBody Datablock and set maxBackwardSpeed = 0
Now the player can not move backwards.
----------
The second way above allows you to retain the backwards movements for out of ship movement on space stations and such and then when the player gets into a vehicle you can just use the Vehicles Datablock and set its maxBackwardSpeed to 0 and the vehicle will not be able to move backwards but the player still can when not in the vehicle / spaceship.
#6
Your first solution disables backward movement completely, so is not useful in a lot of cases.
Your second solution doesn't apply to my case, but could be useful to someone else.
Thanks for your help.
01/15/2008 (4:20 pm)
Well your third solution doesn't seem to work at all. I tried that about a month ago and no dice.Your first solution disables backward movement completely, so is not useful in a lot of cases.
Your second solution doesn't apply to my case, but could be useful to someone else.
Thanks for your help.
#7
01/15/2008 (4:46 pm)
Maybe set up a seprate keybind setup for vehicles, then remove the back move bind for vehicles. That way you can have both..
#8
01/15/2008 (9:13 pm)
That's a good idea, but that doesn't rule out planes "sliding" backwards when they stop accelerating at a positive slope.
#9
01/19/2008 (12:59 am)
I think sliding backwards is acceptable, no? I mean, it's physics, it's not like it's impossible for a plane to travel backwards - it's just not possible to fly backwards.Quote:you can just use the Vehicles Datablock and set its maxBackwardSpeed to 0 and the vehicle will not be able to move backwards but the player still can when not in the vehicle / spaceship.I couldn't find any reference to a maxBackwardSpeed in VehicleData or FlyingVehicleData, which is why I figured on a source change. Though, yes, if you have separate binds for vehicle controls, removing the 'backwards' bind would solve the problem.
Torque Owner Daniel Buckmaster
T3D Steering Committee