Physics · interface
SurfaceBox
The tops of a set of flat, axis-aligned pads, answering as a ground surface.
Explained in Your first game, Rigid bodies.
interface SurfaceBoximport type { SurfaceBox } from '@driftengine/physics';In depth
For the parts of a route that are platforms rather than ribbon — a flight of steps, a run of pads with gaps between them. Those are still the route, and that is the whole reason this exists rather than letting the collision boxes carry them: a character on ordinary geometry is off the route as far as anything asking the surface is concerned, and the route is what decides top speed, what the camera leans on, and how far along the run somebody is.
Deliberately flat. A pad is an AABB, its top is level, and pretending otherwise would mean inventing a normal that the collider it shares a shape with does not have.
Properties
| Name | Type | Description |
|---|---|---|
minX | number | |
maxX | number | |
minZ | number | |
maxZ | number | |
topY | number | Height of the walkable face. |
distanceM | number | How far along the route this pad sits, metres. |
tangentX | number | Direction of travel across it, for the camera and the pose. |
tangentZ | number |