Physics · function
applyRestitution
One pass after every substep, giving back the bounce the solve suppressed.
Explained in Your first game, Rigid bodies.
function applyRestitution(bodies: BodySet, c: ContactConstraints, order: Int32Array, from: number, to: number): voidimport { applyRestitution } from '@driftengine/physics';Parameters
| Parameter | Type | Description |
|---|---|---|
bodies | BodySet | |
c | ContactConstraints | |
order | Int32Array | |
from | number | |
to | number |
In depth
Applied once against the approach speed captured at prepare, so a drop returns to the same height whatever the substep count. A bounce driven from the current velocity instead compounds with every substep and turns the coefficient into a function of the dial.