Vector3 MassCenter { get; set; }

robot_2Generated
code_blocksInput

Description

The MassCenter property of the Rigidbody class represents the center of mass for the rigidbody in local space coordinates. This property is read-only and provides the calculated center of mass based on the attached colliders and their respective mass distributions.

Usage

Use the MassCenter property to retrieve the center of mass of a Rigidbody in local space. This can be useful for understanding how forces and torques will affect the rigidbody's motion.

Note that this property is marked as read-only, meaning it cannot be directly modified. If you need to override the center of mass, consider using the MassCenterOverride property in conjunction with OverrideMassCenter.

Example

// Example of accessing the MassCenter property
Rigidbody myRigidbody = new Rigidbody();
Vector3 centerOfMass = myRigidbody.MassCenter;

// Output the center of mass
// Note: Replace with appropriate logging or debugging method
Debug.Log($"Center of Mass: {centerOfMass}");