nape-js API
    Preparing search index...

    Class Compound

    A compound physics object — a hierarchical grouping of Bodies, Constraints, and other Compounds.

    Fully modernized — uses ZPP_Compound directly (extracted to TypeScript).

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    • get castBody(): any

      Cast to Body — returns the Body wrapper if this is a Body, else null.

      Returns any

    • get castCompound(): any

      Cast to Compound — returns the Compound wrapper if this is a Compound, else null.

      Returns any

    • get castShape(): any

      Cast to Shape — returns the Shape wrapper if this is a Shape, else null.

      Returns any

    • get cbTypes(): any

      Callback types assigned to this interactor.

      Returns any

    • get id(): number

      Unique numeric identifier for this interactor.

      Returns number

    • get userData(): Record<string, unknown>

      User-defined data storage object.

      Returns Record<string, unknown>

    Methods

    • Distribute all children to the parent compound or space, then remove.

      Returns void

    • Calculate the center of mass of all bodies in this compound.

      Parameters

      • weak: boolean = false

      Returns Vec2

    • Recursively visit all bodies in this compound and its sub-compounds.

      Parameters

      • lambda: (body: Body) => void

      Returns void

    • Recursively visit all sub-compounds in this compound.

      Parameters

      Returns void

    • Recursively visit all constraints in this compound and its sub-compounds.

      Parameters

      Returns void