- Home /
AddTorque behaving different in Unity 4.6
Hello, I recently updated my project to Unity 4.6 and have encountered some weird physics changes. Most notably, when I call the rigidbody2D.AddTorque() method, in unity 4.5, I got a "linear" rotation around an axis in the sense that the gameobject being rotated would rotate at the same speed regardless of whether it was contacting another object or not. In unity 4.6, when the gameobject is in contact with another object, it slows the rotation, and when it is released from contact, it kind of "slingshots" off of it and spins faster.
Here are some video examples from the project I'm working on. This is the exact same project opened in both versions of Unity.
I would like to know what is causing this change and how I could make the physics in Unity 4.6 behave similarly to how they were in Unity 4.5
Here's the code in charge of the gameobject's rotation. It's pretty straightforward. Note that leanSpeed is a public float variable.
if (Input.GetKey(KeyCode.LeftArrow))
{
rigidbody2D.AddTorque(100 * leanSpeed);
}
if (Input.GetKey(KeyCode.RightArrow))
{
rigidbody2D.AddTorque(-100 * leanSpeed);
}
Thanks in advance!