Physics · function
collideCompound
Every touching pair of parts, as one manifold each.
Explained in Your first game, Rigid bodies.
function collideCompound(shapeA: ConvexShape | undefined, partsA: readonly ConvexShape[] | undefined, poseA: ShapePose, shapeB: ConvexShape | undefined, partsB: readonly ConvexShape[] | undefined, poseB: ShapePose, margin: number, out: readonly Manifold[]): numberimport { collideCompound } from '@driftengine/physics';Parameters
| Parameter | Type | Description |
|---|---|---|
shapeA | ConvexShape | undefined | |
partsA | readonly ConvexShape[] | undefined | |
poseA | ShapePose | |
shapeB | ConvexShape | undefined | |
partsB | readonly ConvexShape[] | undefined | |
poseB | ShapePose | |
margin | number | |
out | readonly Manifold[] |
In depth
A mesh partner is the pair this row exists for, and it gets a rule of its own. A decomposed
body falling onto a level is a dynamic compound against a static mesh, so refusing it would refuse
the case. Each part goes through collideMesh unchanged, and the budget is divided between the
parts that find candidates, never below one each. That is a deliberate departure from the mesh
path's own first-come rule: collideMesh stops at eight and drops the rest, which is defensible
when the ninth candidate is a triangle and indefensible when it is a whole limb of the body — one
leg of a chair sinking through a floor while the other three hold.