Documentation
    Preparing search index...

    Class JointAbstract

    A constraint between two bodies (§28), registered with a world rather than attached to a node (plan P6-3).

    Abstract: construct one of FixedJoint, HingeJoint, SliderJoint, RopeJoint, SpringJoint, or SphericalJoint. See the module header for the anchor convention, what may change after registration, and how breakage works.

    Hierarchy (View Summary)

    Index
    • Validates and stores the parts of options every joint shares.

      Vectors are copied, so the caller keeps ownership of what it passes in. The "2d" plane rules are not checked here — a joint does not know which world it will join — and run at world.addJoint, which is the first moment the dimension is known (the rule RigidBody follows).

      Parameters

      Returns Joint

    bodyA: RigidBody

    First constrained body (§28).

    bodyB: RigidBody

    Second constrained body (§28).

    broken: boolean

    Set once when a §28 break threshold is exceeded; never cleared.

    id: number | undefined

    The world's monotonic id while registered, undefined otherwise.

    Which §28 constraint this is — the descriptor's discriminant.

    • get anchorA(): Vector3 | undefined

      Attachment point on Joint.bodyA.

      World space until Joint.setAnchors or world.addJoint converts it to bodyA's local frame. After that, reads and writes are body-local (PH-22f). undefined means the body's own origin.

      Returns Vector3 | undefined

    • set anchorA(value: Vector3Input | undefined): void

      Sets the attachment point on Joint.bodyA in body-local space and queues it when the joint is registered. See Joint.setAnchors.

      Parameters

      Returns void

    • get anchorB(): Vector3 | undefined

      Attachment point on Joint.bodyB. See Joint.anchorA.

      Returns Vector3 | undefined

    • set anchorB(value: Vector3Input | undefined): void

      Sets the attachment point on Joint.bodyB in body-local space and queues it when the joint is registered. See Joint.setAnchors.

      Parameters

      Returns void

    • get anchorsAreLocal(): boolean

      Whether Joint.anchorA / Joint.anchorB are body-local (PH-22f). false after construction (world-space options); true after addJoint writes the converted frames back, or after Joint.setAnchors.

      Returns boolean

    • get breakable(): boolean

      Whether either §28 break threshold is set, so the world must monitor it.

      Returns boolean

    • get breakForce(): number | undefined

      Reaction force in newtons above which this joint breaks (§28), or undefined for a joint that never breaks.

      Settable at any time, registered or not: the threshold is compared by the world after each step and never reaches the solver, so there is nothing to reconfigure. Setting one on a registered joint whose adapter cannot report reactions is not rejected here — the check belongs where the adapter is known, at world.addJoint.

      Returns number | undefined

    • set breakForce(value: number | undefined): void

      Parameters

      • value: number | undefined

      Returns void

    • get breakTorque(): number | undefined

      Reaction torque in N·m above which this joint breaks (§28).

      Returns number | undefined

    • set breakTorque(value: number | undefined): void

      Parameters

      • value: number | undefined

      Returns void

    • get collisionEnabled(): boolean

      Whether the two bodies still collide with each other (§28).

      Live since PH-22f (2026-08-08). Setting it on a registered joint queues the change, exactly as HingeJoint.setLimits does, and the world drains it into SolverJointAccess.setJointCollisionEnabled at the top of the next fixed step (§26's commands-not-mutations rule — the solver may be mid-step, and §6b forbids physics work during dispatch). Writing the value it already holds queues nothing.

      Anchors joined it as the other live §28 property every shipped solver can change — see Joint.setAnchors. Axis, rope length, spring terms and the spherical swing cone stay frozen; see the module header's table.

      Returns boolean

    • set collisionEnabled(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get disposed(): boolean

      Whether Joint.dispose has run. Disposal is terminal (§83): a disposed joint refuses world registration with INVALID_APPLICATION_STATE (§89) rather than silently working.

      Returns boolean

    • get registered(): boolean

      Whether a world currently holds this joint (its Joint.id is set).

      Returns boolean

    • Drops every listener (§83). Removing the joint from its world is the world's business, exactly as it is for RigidBody.

      Returns void

    • Delivers event to the listeners registered for type in registration order. Re-entrant emission of type is deferred (rule 4).

      Type Parameters

      • K extends "jointbreak"

      Parameters

      Returns void

    • Number of live registrations for type (diagnostics, §83).

      Type Parameters

      • K extends "jointbreak"

      Parameters

      • type: K

      Returns number

    • Number of live listener registrations across every event type (§83).

      Used by teardown diagnostics — a detached node that still holds listeners pins its subtree until those listeners are removed.

      Returns number

    • Removes the earliest still-registered registration of listener for type. Removing a listener that is not registered is a no-op.

      Type Parameters

      • K extends "jointbreak"

      Parameters

      Returns void

    • Registers listener for type. Returns a function that removes it.

      The same listener may be registered more than once; each registration is independent and is delivered once per dispatch.

      Type Parameters

      • K extends "jointbreak"

      Parameters

      Returns Unsubscribe

    • Marks the reconfiguration queue; used by the limit and motor setters.

      Returns void

    • Marks the reconfiguration queue; used by the motor setters.

      Returns void

    • Removes every listener, or every listener of one type. Used by teardown paths that must not leave detached nodes retaining listeners (§83).

      Type Parameters

      • K extends "jointbreak"

      Parameters

      • Optionaltype: K

      Returns void

    • Replaces both attachment points with body-local vectors and queues them for the solver (§28, PH-22f).

      The frames are the same ones stored after world.addJoint converts the world-space constructor options. They are not re-measured against the current world poses and not re-measured against the authoring poses — the caller supplies local-space points. undefined means that body's origin.

      Takes effect at the next fixed step, like HingeJoint.setLimits. Writing the values already stored queues nothing. Unregistered, the write is immediate and the next addJoint uses these locals as-is (it does not convert them as world-space).

      Parameters

      Returns void

    • The descriptor an adapter is handed for this joint (§37 createJoint), with the body-local frames binding carries.

      The record is fresh; its vectors are binding's, which the adapter reads during createJoint and must not retain (the contract RigidBody.toDescriptor already sets).

      Parameters

      Returns JointDescriptor

    • Writes this joint's world-space axis into out, or zeroes it when the type has none (§28).

      dimension is passed because the default differs: a hinge in a "2d" world has exactly one possible axis (+Z, §21) and needs no author to say so, while a hinge in a "3d" world must name one — an unnamed 3D hinge leaves the axis zero, which validateJointDescriptor then rejects with the message that explains it.

      Parameters

      Returns Vector3