Unity Physicals Rigidbody with multiple colliders

Unity Physicals Rigidbody with multiple colliders

Adding colliders changes the center of mass and rotation behaviour of a rigidbody. To set those manualy to the center of the object use:

void Start()
{
    rigidbody = GetComponent<Rigidbody>();
    rigidbody.centerOfMass = Vector3.zero;
    rigidbody.inertiaTensorRotation = new Quaternion(0, 0, 0, 1);
}
1
2
3
4
5
6

It seems this set center of mass feature in unity 4 is not required. But after you upgrade your project to unity 5+, you will come across some very strange bugs which missing set center of mass. In vehicle physicals logic (such as RCC), this step is MUST HAVE.

评论