Skip to content

Track

Defined in: packages/engine/src/gameplay/track/track.ts:131

A path an entity rides in track coordinates: a distance along its centerline, an offset across it, and a height above it. Built once from its points, sampled every half metre of arc length.

new Track(points, __namedParameters?): Track

Defined in: packages/engine/src/gameplay/track/track.ts:140

At least two points.

Parameter Type
points TrackPoint[]
__namedParameters TrackOptions

Track

get length(): number

Defined in: packages/engine/src/gameplay/track/track.ts:197

Metres from the start to the end, along the samples.

number

frameAt(distance, into?): TrackFrame

Defined in: packages/engine/src/gameplay/track/track.ts:204

The frame distance metres along, clamped to the track, blended between the two samples either side, written into into: fresh vectors unless the caller hands its own, as a step does.

Parameter Type
distance number
into TrackFrame

TrackFrame


frictionAt(distance, lateral): number

Defined in: packages/engine/src/gameplay/track/track.ts:259

The 1/s its surface costs a grounded mover at distance along and lateral across: none unless the track was built with friction.

Parameter Type
distance number
lateral number

number


locate(point): object

Defined in: packages/engine/src/gameplay/track/track.ts:270

The track coordinates of a world point: projected on the frame of the nearest sample, so the distance runs on between samples. ponytail: a scan of every sample, about 2000 on a kilometre; a spatial index once something calls this per vertex.

Parameter Type
point { x: number; y: number; z: number; }
point.x number
point.y number
point.z number

object

Name Type
distance number
lateral number

pointAt(distance, lateral): Vector3

Defined in: packages/engine/src/gameplay/track/track.ts:228

The world point distance along and lateral across, positive to the right of the direction of travel.

Parameter Type
distance number
lateral number

Vector3


zoneWeight(distance, zone): number

Defined in: packages/engine/src/gameplay/track/track.ts:236

How much of zone the track is at distance, from 0 to 1: its points’ tags blended from one point to the next, and held past the ends.

Parameter Type
distance number
zone string

number