Skip to content

SpringJointConfig

Defined in: physics/src/types.ts:76

Elastic connection between two bodies. Pulls together when stretched past restLength, pushes apart when compressed below it. Every number is finite; restLength, stiffness and damping are >= 0.

optional anchorA?: Vec2Like

Defined in: physics/src/types.ts:90

Attachment point on body A in pixels, local to the body. Default: body origin.


optional anchorB?: Vec2Like

Defined in: physics/src/types.ts:92

Attachment point on body B in pixels, local to the body. Default: body origin.


damping: number

Defined in: physics/src/types.ts:88

Resists relative motion along the spring axis. Same mass-relative units as stiffness.


restLength: number

Defined in: physics/src/types.ts:79

Distance the spring tries to hold, in pixels.


stiffness: number

Defined in: physics/src/types.ts:86

Spring strength, mass-relative: a body of mass m stretched by d pixels accelerates at stiffness * d / m px/s². Passed to the solver unconverted, and collider mass depends on pixelsPerMeter (density × area in meters) — retune after changing the scale.


type: "spring"

Defined in: physics/src/types.ts:77