The player can use the up and down arrow keys to give the rigidbody momentum (the keys enable and disable thrust). This acts like acceleration, by calling rigidbody.AddRelativeForce . This was exactly what I wanted.
I then went and made it so the player could turn the rigidbody, by implementing rigidbody.AddRelativeTorque . This did not achieve the desired effect, as the directional vector already in place caused the rigidbody to drift.
My question is: how do I rotate this rigidbody such that momentum rotates with the object? More precisely, is there a function that will do it for me, or should I use the math component to manually rotate the force vector on the rigidbody?
Thanks for the help!
It's not physical, but you could just rotate the velocity vector and reapply it. This typically results in more intuitive, better feeling controls.
EDIT The easiest way to do this is maintain a transform as the current intended velocity vector. Rotate the transform when the player rotates, and then call Transform.forward.
Multiply that by the Rigidbody.velocity.magnitude and reassign that to Rigidbody.velocity.
It is not physically acurate to do this, of course, but you can acheive it easily by rotating the current velocity of the ship.
answered Jan 29 '10 at 12:45 AM