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): void
import { applyRestitution } from '@driftengine/physics';

Parameters

ParameterTypeDescription
bodiesBodySet
cContactConstraints
orderInt32Array
fromnumber
tonumber

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.