Collider:getCenterOfMass

Edit

Returns the Collider's center of mass, in the Collider's local coordinate space.

x, y, z = Collider:getCenterOfMass()

Arguments

None

Returns

NameTypeDescription
xnumber The x component of the center of mass.
ynumber The y component of the center of mass.
znumber The z component of the center of mass.

Notes

By default, the center of mass of the Collider is kept up to date automatically as the Collider's shapes change. To disable this, use Collider:setAutomaticMass.

Use Collider:resetMassData to reset the center of mass and other mass properties based on the Collider's shapes.

See also