Physics · function

boxCollider

The collider of a drawn box, exactly where it is drawn.

Explained in Your first game, Rigid bodies.

function boxCollider(cx: number, cy: number, cz: number, hx: number, hy: number, hz: number): Collider
import { boxCollider } from '@driftengine/physics';

Parameters

ParameterTypeDescription
cxnumber
cynumber
cznumber
hxnumber
hynumber
hznumber

In depth

Same centre and half-extents a mesh builder takes, so a game that draws a box gets its collision from the same numbers — nothing authored twice. The shape routes the touch through the shape sweep, which is what lets a lid sit flush with a walkable surface: the old world-axis path fought a body for the ground it stood on, and lids had to be sunk out of reach to compensate.