nape-js API
    Preparing search index...

    Class Contact

    Represents a contact point between two colliding shapes.

    Contacts are pooled internally by the engine — they cannot be created directly. Access contacts via CollisionArbiter.contacts.

    Fully modernized — wraps extracted ZPP_Contact directly.

    Index

    Constructors

    Accessors

    • get fresh(): boolean

      Whether this contact was newly created in the current step.

      Returns boolean

    • get penetration(): number

      Penetration depth of this contact (positive = overlapping).

      Returns number

    Methods

    • Normal impulse at this contact point.

      Parameters

      • body: Body | null = null

        If null, returns world-frame impulse. Otherwise returns impulse on the given body (must be one of the two in contact).

      Returns Vec3

    • Rolling impulse at this contact point.

      Parameters

      • body: Body | null = null

        If null, returns total rolling impulse. Otherwise returns rolling impulse on the given body.

      Returns number

    • Tangent impulse at this contact point.

      Parameters

      • body: Body | null = null

        If null, returns world-frame impulse. Otherwise returns impulse on the given body.

      Returns Vec3

    • Total impulse (normal + tangent + rolling) at this contact point.

      Parameters

      • body: Body | null = null

        If null, returns world-frame impulse. Otherwise returns impulse on the given body.

      Returns Vec3