What affect do colliders have on a rigidbody

I have a car that I have set the center of mass on. Everything seems fine and works as expected, but i noticed that the car still behaves differently when I add a new mesh with a mesh collider. I basically want to be able to add another mesh collider on the car, but keep the behaviour the same. I have also tried setting the center of mass after I add the collider and it has the same problem.

                    Debug.Log(rBody.centerOfMass.x + "," + rBody.centerOfMass.y + "," + rBody.centerOfMass.z + " - " + rBody.worldCenterOfMass.x + "," + rBody.worldCenterOfMass.y + "," + rBody.worldCenterOfMass.z + " - " + rBody.mass);
                    rBody.centerOfMass = centerOfMass;
                    Debug.Log(rBody.centerOfMass.x + "," + rBody.centerOfMass.y + "," + rBody.centerOfMass.z + " - " + rBody.worldCenterOfMass.x + "," + rBody.worldCenterOfMass.y + "," + rBody.worldCenterOfMass.z + " - " + rBody.mass);

The colliders also define the inertia tensor for the rigidbody:

You should also preserve it for keeping the same behavior after adding colliders.

Thanks, looks like thats what the problem was.

1 Like