Let’s say I change rigidBody’s center of mass in the Awake method.
void Awake()
{
rigidbody.centerOfMass = new Vector3(0,0,-1);
}
After this, are the torque/inertia tensor calculations based on the old (0,0,0) or the new(0,0,-1) position of center of mass.
And an other question about inertiaTensor calculation. Will Unity calculate a new inertiaTensor when a rigidbody’s collider is enable/disable or a new collider is added as a child?
the rigidbody will recalculate M, COM, and I on start and whenever a collider is added or removed. A warning about adding new colliders as child while running, unity has a rather annoying glitch that causes the rigidbody to lock up and not recalculate sometimes which causes it to ignore some of the child colliders. see my post for possible work around.
After a short testing in Unity 4.5xxxx I found out:
Unity calculates center of mass and inertia tensor at the start and when collider is added as a child.
Unity doesn’t calculate center of mass and inertia tensor when a child collider is removed or disabled or enabled.
When center of mass is changed in the Awake method the inertia tensor will be the same than in case of the unchanged center of mass and physic simulation is based on current center of mass.