Physics · function
solveJoints
Solve every joint in a range, one iteration.
Explained in Your first game, Rigid bodies.
function solveJoints(bodies: BodySet, joints: JointSet, order: Int32Array, from: number, to: number, h: number,import { solveJoints } from '@driftengine/physics';Parameters
| Parameter | Type | Description |
|---|---|---|
bodies | BodySet | |
joints | JointSet | |
order | Int32Array | |
from | number | |
to | number | |
h | number | |
/** * The whole tick | | |
which is what a motor's force budget is measured over. * * `maxForce` means a force | | |
and a force acting for a tick is `maxForce · dt` of impulse. Bounding * the accumulator by `maxForce · h` instead gives the entire tick one substep's worth | | |
so raising * the substep count silently weakens every motor — measured | | |
a hinge told to reach 4 rad/s got to * 0.13 in a tick where it should have reached 0.5. */ dt: number | | |
useBias | boolean | |
hertz | number | |
damping | number |
In depth
useBias is false on the relax pass, exactly as it is for contacts, so the positional push a
joint applies is taken back rather than left as energy.