So lets say I rotate my object on its y axis, If I then make it rotate on its x axis, it’ll stop rotating on its y axis completely. How do I conserve the momentum?
Here’s the script I’m using:
function FixedUpdate () {
if (Input.GetKey(“left”))
{
rigidbody.AddRelativeTorque (Vector3.up * -10);
}
if (Input.GetKey(“up”))
{
rigidbody.AddRelativeTorque (Vector3.forward * 10);
}
}
kilgore
2
Add Time.deltaTime to your equation like the following.
function FixedUpdate ()
{
if (Input.GetKey("left"))
{
rigidbody.AddRelativeTorque (Vector3.up * -10 * Time.deltaTime);
}
if (Input.GetKey("up"))
{
rigidbody.AddRelativeTorque (Vector3.forward * 10 * Time.deltaTime);
}
}