Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

PhysicsBody.massOverride

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public MassOverride massOverride;

Description

Selects which of the mass, rotational inertia and center of mass are overridden with authored values instead of being computed from the attached shapes.

Whenever the mass configuration is recalculated, for any reason, the overridden values take their authored values and the rest are computed from the attached shapes as normal. A rotational inertia that is not itself overridden is scaled to an overridden mass and shifted to an overridden center, so it stays physically consistent with the values you chose. Setting this property recalculates the mass configuration immediately: anything whose bit was removed returns to its shape-derived value, and anything whose bit was added takes effect. Assign PhysicsBody.massConfiguration to author the override values. Only a PhysicsBody.BodyType.Dynamic body has a mass configuration to override; the flags are retained across body type changes and reapply when the body is dynamic again. See PhysicsBodyDefinition.massOverride to set this and the authored configuration when creating a body.