Documentation
    Preparing search index...

    Function resolveDensity

    • The density used to derive a collider's mass (§25, §23).

      §25's rule, verbatim: "Collider.density (§24) is authoritative for mass derivation (§23); PhysicsMaterial.density is a fallback used only when the collider does not set one." With neither present the result is DEFAULT_DENSITY.

      resolveDensity(7800, steel); // 7800 — the collider wins
      resolveDensity(undefined, steel); // steel.density
      resolveDensity(undefined); // DEFAULT_DENSITY

      A collider density of 0 is a set density, not an absent one, so it wins over the material — ?? and not ||, deliberately.

      Parameters

      Returns number