density
The density of the collider used to calculate its mass (when auto mass is enabled).
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Property
- Namespace: UnityEngine
- Assembly: UnityEngine.Physics2DModule
public float density { get; set; }
Remarks
When using _useAutoMass, increasing the collider density increases its mass - as does increasing its area - as the collider mass is calculated as a product of density and area.
Note that by default, _useAutoMass is disabled, so the mass of the collider is set directly by _mass, and this density value is ignored.
Additional Resources: _mass, _useAutoMass