Physics · interface
SurfaceHit
Explained in Your first game, Rigid bodies.
interface SurfaceHitimport type { SurfaceHit } from '@driftengine/physics';Properties
| Name | Type | Description |
|---|---|---|
y | number | Height of the surface in the queried column. |
normalX | number | |
normalY | number | |
normalZ | number | |
tangentX | number | Direction of travel at the nearest point on the centreline. |
tangentY | number | |
tangentZ | number | |
distanceM | number | Arc length of that nearest point. How far along the route you are. |
lateralM | number | Signed offset from the centreline, positive to the character's right. |
halfWidthM | number | Half the surface's width here — how much room is left before the edge. |
bankRad | number | |
tiltX | number | Which way up looks here — the ruled surface's own normal, not the
cross-section's.MoreA separate field because it answers a separate question. This one is about how the surface looks where you are standing on it, and on a deck whose bank rolls it is a very different number: the ruled surface climbs far more steeply along the route near its edges than the centreline does — 57° measured on one chicane against the centreline's 11°, and past vertical on a chute. Correct geometry, and correct for orienting a body that has to look like it is on the deck. Fed to the walking rules instead it takes the ground away: a character met a chicane's edge as a wall and fell down it at 20 m/s a hand's width above the deck, never landing, which is exactly what flying looks like. |
tiltY | number | |
tiltZ | number |