Physics · function

shapecastWorld

Sweep a shape from one point to another and report the first body it touches.

Explained in Your first game, Rigid bodies.

function shapecastWorld(bodies: BodySet, tree: DynamicTree, shape: ConvexShape, pose: ShapePose, dx: number, dy: number, dz: number, out: RayHit, filter?: QueryFilter): boolean
import { shapecastWorld } from '@driftengine/physics';

Parameters

ParameterTypeDescription
bodiesBodySet
treeDynamicTree
shapeConvexShape
poseShapePose
dxnumber
dynumber
dznumber
outRayHit
filter?QueryFilter

In depth

Conservative advancement: step by the current separation, which cannot overshoot a contact, and stop after a fixed number of steps. A fixed count rather than a tolerance, because §3a forbids iterating to one.