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).
Equilibrium distance between anchors (must be >= 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.
Equilibrium distance between anchors (pixels, must be >= 0).
SpringJoint is always soft — setting stiff to true is not allowed.
Use DistanceJoint if you need a rigid distance constraint.
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.
A spring/damper constraint between two anchor points on two bodies.
Applies a spring force that pulls or pushes the anchors toward a target
restLength. The spring behavior is controlled byfrequency(Hz) anddamping(ratio), inherited from Constraint.Unlike DistanceJoint, a SpringJoint:
restLengthinstead of a[jointMin, jointMax]range.Ideal for: vehicle suspension, soft-body connections, ragdoll hair/cloth, bouncy UI animations, bridge/rope segments, trampolines.
Example