Home Technical Talk

Physics question in Unity - conserving momentum

polycounter lvl 10
Offline / Send Message
Commodore polycounter lvl 10
Hey guys, this is my first post on this site. I'm using unity and I ran into a problem that I don't know how to fix. I have no clue what to search to fix it either so if somebody could link me to a thread explaining it that'd be great!

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 in case you're wondering.


function FixedUpdate () {
if (Input.GetKey("left"))
{
rigidbody.AddRelativeTorque (Vector3.up * -10);
}
if (Input.GetKey("up"))
{
rigidbody.AddRelativeTorque (Vector3.forward * 10);
}
}

Replies

Sign In or Register to comment.