Physics · interface

DistanceConstraints

Distance constraints: two particles, a rest length, a compliance (metres per newton).

Explained in Your first game, Rigid bodies.

interface DistanceConstraints
import type { DistanceConstraints } from '@driftengine/physics';

Properties

NameTypeDescription
pairsreadonlyUint32ArrayTwo particle indices a constraint.
restreadonlyFloat32Array
compliancereadonlyFloat32Array
batchesreadonlyoptionalUint32ArrayGraph-colour batches, as offsets into the constraints: batch b is constraints batches[b] to batches[b + 1], none of which moves a particle another in the batch moves. Absent, the solver colours them itself. Given, they are checked and refused if they overlap.