Physics · class

RibbonSurface

Explained in Your first game, Rigid bodies.

class RibbonSurface
import { RibbonSurface } from '@driftengine/physics';

Constructor

new

constructor(spline: Spline, options?: RibbonSurfaceOptions)
ParameterTypeDescription
splineSpline
options?RibbonSurfaceOptions

Methods

sample

sample(x: number, z: number, out: SurfaceHit, atY?: number): boolean

Ask what the surface is doing in the column above/below (x, z).

ParameterTypeDescription
xnumber
znumber
outSurfaceHit
atY?number
More

Returns false where there is no surface — off the edge, past either end, or over a hole — and leaves out untouched in that case.

sampleBand

sampleBand(x: number, z: number, out: SurfaceHit, loY: number, hiY: number): boolean

See GroundSurface.sampleBand: the highest pass in the band, exactly.

ParameterTypeDescription
xnumber
znumber
outSurfaceHit
loYnumber
hiYnumber