Skip to content

SpringJointConfig

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

Elastic connection between two bodies. Pulls together when stretched past restLength, pushes apart when compressed below it.

optional anchorA?: Vec2Like

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

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


optional anchorB?: Vec2Like

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

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


damping: number

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

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


restLength: number

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

Distance the spring tries to hold, in pixels.


stiffness: number

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

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:73