Physics · interface

RibbonSurfaceOptions

Explained in Your first game, Rigid bodies.

interface RibbonSurfaceOptions
import type { RibbonSurfaceOptions } from '@driftengine/physics';

Properties

NameTypeDescription
cellMoptionalnumberSide of a seed grid cell, metres.
holesoptionalreadonly RibbonHole[]Stretches of arc length where there is no surface at all.
marginMoptionalnumberExtra width, each side, that still counts as being over the surface. A character is a box, not a point, and the edge should be forgiving by about half of one.
holeEdgeMoptionalnumberHow far the mesh keeps deck past the start of a hole, metres — one cross-section step.
More

A hole is authored as a span of arc length and a ribbon's geometry cannot cut exactly there. buildRibbon keeps the cross-section that borders a hole, deliberately, so the deck before it gets its end cap in the right place instead of stopping a step short — so the drawn lip can reach a full step into the authored span. A surface that does not know that figure reports no ground under deck a character can plainly see and is standing on.

Defaults to the ribbon builder's own default step, so a caller who has not changed the step does not have to say so; a caller who has must pass it, or the two disagree by the difference.

edgeBandMoptionalnumberWidth of the raised trim down each edge, metres, and how far it stands proud.
More

A kerb is drawn as its own ribbon over the outermost band of the deck, lifted a few centimetres — and a surface that does not know about it reports the deck's height under geometry the player can plainly see they are standing on, so their feet sink into it. The two figures are the same ones the kerb ribbon is built from, passed here so the drawn trim and the walkable floor cannot disagree.

Zero by default, which is every consumer that has no trim: the arithmetic below is skipped entirely rather than adding zero.

edgeLiftMoptionalnumber