HoverVehicle Help
by Tom O'Neill · in Torque Game Engine · 10/15/2005 (9:15 am) · 0 replies
Hey,
I'm fairly new to Torque. I currently have a HoverVehicle implemented in my game, but it doesn't quite have the mechanics I desire.
Currently, steering affects movement. That is to say, if I've got the vehicle moving in a certain direction and then stop pressing keys, rotating the vehicle with the mouse changes the direction it's moving. What I want to be able to do (for example) is accelerate the vehicle to a certain speed going forward (so the vehicle is moving in the same direction as it is facing), stop accelerating, and be able to rotate the vehicle 180degrees so now it is moving backwards. Essentially I want to decouple the direction the vehicle is facing from its vector of movement. It seems like it should be simple enough, the only things that should affect vehicle movement are accelerate forward, accelerate backwards, accelerate (strafe) left, and accelerate (strafe) right. Looking should be only that, looking, rotating, not affecting the vehicle's vector.
Just from a cursory overview of the code, it looks like the vehicle's vector is stored in Vehicle::mRigid.linVelocity. Is this an absolute vector, or relative to the vehicle? That is, when the vehicle rotates, does the direction the vector is pointing in the world stay the same, or change? It seems like the vector is relative to the vehicle (just from how the mechanics seem to work in game) but I'm not sure.
Thoughts? Is there a quick and easy way to do what I want to do?
Thanks.
I'm fairly new to Torque. I currently have a HoverVehicle implemented in my game, but it doesn't quite have the mechanics I desire.
Currently, steering affects movement. That is to say, if I've got the vehicle moving in a certain direction and then stop pressing keys, rotating the vehicle with the mouse changes the direction it's moving. What I want to be able to do (for example) is accelerate the vehicle to a certain speed going forward (so the vehicle is moving in the same direction as it is facing), stop accelerating, and be able to rotate the vehicle 180degrees so now it is moving backwards. Essentially I want to decouple the direction the vehicle is facing from its vector of movement. It seems like it should be simple enough, the only things that should affect vehicle movement are accelerate forward, accelerate backwards, accelerate (strafe) left, and accelerate (strafe) right. Looking should be only that, looking, rotating, not affecting the vehicle's vector.
Just from a cursory overview of the code, it looks like the vehicle's vector is stored in Vehicle::mRigid.linVelocity. Is this an absolute vector, or relative to the vehicle? That is, when the vehicle rotates, does the direction the vector is pointing in the world stay the same, or change? It seems like the vector is relative to the vehicle (just from how the mechanics seem to work in game) but I'm not sure.
Thoughts? Is there a quick and easy way to do what I want to do?
Thanks.
About the author