Physics · function

collideShapes

Fill out and return whether the shapes are within margin of touching.

Explained in Your first game, Rigid bodies.

function collideShapes(shapeA: ConvexShape, poseA: ShapePose, shapeB: ConvexShape, poseB: ShapePose, margin: number, out: Manifold): boolean
import { collideShapes } from '@driftengine/physics';

Parameters

ParameterTypeDescription
shapeAConvexShape
poseAShapePose
shapeBConvexShape
poseBShapePose
marginnumber
outManifold

In depth

A positive separation inside the margin is a speculative contact: the constraint will permit approach up to exactly that gap and no further, which is what gives continuous collision without a separate time-of-impact pass.