Description
The MassCenterOverride
property allows you to specify a custom center of mass for a Rigidbody
in local space coordinates. This property is useful when you need to adjust the center of mass for specific physics behaviors, such as balancing or simulating non-uniform mass distribution.
Usage
To use the MassCenterOverride
property, ensure that the OverrideMassCenter
property is set to true
. This will enable the custom mass center override. You can then assign a Vector3
value to MassCenterOverride
to define the new center of mass in local space coordinates.
Example
// Example of setting a custom mass center for a Rigidbody
Rigidbody myRigidbody = new Rigidbody();
myRigidbody.OverrideMassCenter = true; // Enable mass center override
myRigidbody.MassCenterOverride = new Vector3(0.5f, 0.0f, 0.0f); // Set custom mass center