Vector3 MassCenterOverride { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The MassCenterOverride property of the Rigidbody class allows you to specify a custom center of mass for the rigid body. This property is of type Vector3 and is used to override the default center of mass calculated by the physics engine. This can be useful for achieving specific physical behaviors or balancing the object in a particular way.

The property is only effective when the OverrideMassCenter boolean property is set to true. If OverrideMassCenter is false, the physics engine will use the default center of mass.

Usage

To use the MassCenterOverride property, ensure that the OverrideMassCenter property is set to true. Then, assign a Vector3 value to MassCenterOverride to specify the desired center of mass.

Example usage:

Rigidbody rigidbody = new Rigidbody();
rigidbody.OverrideMassCenter = true;
rigidbody.MassCenterOverride = new Vector3(0.5f, 0.0f, 0.0f);

This example sets the center of mass to be offset along the x-axis by 0.5 units.

Example

Rigidbody rigidbody = new Rigidbody();
rigidbody.OverrideMassCenter = true;
rigidbody.MassCenterOverride = new Vector3(0.5f, 0.0f, 0.0f);