Physics · function

heightSurface

One field, or several stacked in the same world.

Explained in Your first game, Rigid bodies.

function heightSurface(heightAt: HeightField | readonly HeightField[], options?: HeightSurfaceOptions): GroundSurface
import { heightSurface } from '@driftengine/physics';

Parameters

ParameterTypeDescription
heightAtHeightField | readonly HeightField[]
options?HeightSurfaceOptions

In depth

Several is how a road passes under a road. A single field has exactly one height per column, and no arrangement of it holds both a deck and the carriageway beneath it; two fields do, and the surface picks the one under the body's feet using the height every caller already passes. Order carries no meaning — the rule is nearness to the asker, not position in the list.

Each layer answers NaN where it is not there, so a deck is a floor over its span and nothing at all beside it.