First body, or null for a static world anchor.
Second body, or null for a static world anchor.
Anchor point in body1's local space (disposed if weak).
Anchor point in body2's local space (disposed if weak).
Target relative angle offset in radians. Default 0.0.
The set of CbTypes assigned to this constraint. Used to filter which listeners respond to this constraint's events.
Whether the constraint's simulation component is currently sleeping.
Only valid when the constraint is active and in a space — throws otherwise.
Arbitrary user data attached to this constraint.
Lazily initialized to {} on first access.
Creates and returns a copy of this constraint with the same parameters. The copy is not automatically added to a space.
Invokes fn once for each distinct body linked to this constraint.
Weld joint — constrains two bodies to maintain a fixed relative position and relative angle, effectively gluing them together while still treating them as separate physics objects.
The
phaseparameter sets the desired relative angle offset in radians. Whenphase = 0both bodies maintain the angle difference they had at the time the joint was created.Example
Fully modernized — uses ZPP_WeldJoint directly (extracted to TypeScript).