- Home /
AddTorque vs Colliders
float h = Input.GetAxis("Mouse X");
float v = Input.GetAxis("Mouse Y");
float a = movement.turnSpeed;
float vForce = v * -a;
vForce = Mathf.Clamp(vForce, -a, a);
float hForce = h * a;
hForce = Mathf.Clamp(hForce, -a, a);
rigidbody.AddRelativeTorque(vForce, hForce, 0);
I use this to rotate the player ship, but the moment I add a collider the whole thing gets screwed up with uneven pitch/turn ratios.
Is there a way to make the AddTorque ignore the collider or make the force applied scale with the collider dimensions/axis?
Answer by Bunny83 · Jan 29, 2013 at 11:56 AM
Unity calculates the inertiaTensor from the RB's colliders. rigidbody.inertiaTensor and rigidbody.inertiaTensorRotation allows you to specify your own.
http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-inertiaTensor.html
http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-inertiaTensorRotation.html
Your answer
Follow this Question
Related Questions
Collider changes RB rotation point 0 Answers
Internal collisions 1 Answer
How having correct bounce on a rotating pinwheel(it's more complicated)? 0 Answers
Unwanted jittery behavior 2 Answers
Sphere, internal collision 1 Answer