Instrumentation · interface

ContactReport

What is around a box, in numbers a person can check.

Explained in In-game tools.

interface ContactReport
import type { ContactReport } from '@driftengine/core';

In depth

A development tool, not a physics path: collide.ts already resolves contacts and is tuned to do it without allocating. This answers a different question — which colliders are here, and by how much — for a diagnostic that runs when somebody presses a key, so it favours being readable over being fast.

Signed depth per axis rather than a single distance, because the two failures worth telling apart look identical otherwise: a body 5 cm inside a deck and a body 5 cm above one are both "5 cm from a collider".

Properties

NameTypeDescription
indexnumber
hullbooleanTrue where the collider is a hull; its box is then the broad phase only.
minXnumber
minYnumber
minZnumber
maxXnumber
maxYnumber
maxZnumber
depthXnumberOverlap along the axis. Positive is penetration, negative is the gap.
depthYnumber
depthZnumber
distanceMnumberStraight line between the boxes. Zero exactly when all three axes overlap.