Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


useAutoMass

Should the total rigid-body Rigidbody2D.mass be automatically calculated from the Collider2D.density of attached colliders?
Read time 1 minuteLast updated 9 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.Physics2DModule
public bool useAutoMass { get; set; }

Remarks

When false, the explicitly set Rigidbody2D.mass is used for the rigid-body mass. When true, the mass is automatically calculated from all attached Collider2D as a product of their Collider2D.density and area.
When true, inside the Unity editor, the Collider2D.density property will appear on any attached Collider2D and the Rigidbody2D.mass property will become read-only.
When false, the Rigidbody2D.mass property can be written to and the Collider2D.density property is not shown.
Additional Resources: Rigidbody2D.mass, Collider2D.density.