- Home /
inertiaTensor stopping automatic rotation
I'm developing a top down racing game, and the collisions were all weird and un-natural (vid here), it was suggested to me that I use inertiaTensor to fix this issue, so now I'm setting the following in Start():
goRigidbody.inertiaTensor = new Vector3(1e5f, 1e5f, 1e5f);
This makes the collisions work perfectly, I couldn't be happier with how a car now acts when colliding with anything else, however, the car no longer rotates when going up/down an incline.
The car still rotates on the Y-axis, when I press a/d to turn the car, but won't automatically rotate on the X or Z-axis when going up/ down an incline.
I've been googling around to try and find a solution, but have so far come up with nothing. The rigidbody doesn't have any rotations or positions frozen, is anyone able to help solve this little problem?
Answer by Carwashh · Jul 03, 2015 at 05:07 PM
Well, how annoying, I've just figured it out by myself, though I'm not sure I understand it.
Changing the 2 axis that I want to rotate on freely (X and Z) to a lower value than the Y-axis, it now rotates correctly.
Working code:
goRigidbody.inertiaTensor = new Vector3(1e3f, 1e5f, 1e3f);
(X-axis and Z-axis changed to 1e3f from 1e5f)
Your answer
Follow this Question
Related Questions
Compute the torque needed to rotate an object at a constant rate 3 Answers
How to check if an object is upside-down? 2 Answers
Random Turning? 1 Answer
Rotational energy formula 0 Answers
Slotcar game 1 Answer