Track
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.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Track(
points,props?):Track
At least two points.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
points |
TrackPoint[] |
props |
TrackOptions |
Returns
Section titled “Returns”Track
Accessors
Section titled “Accessors”length
Section titled “length”Get Signature
Section titled “Get Signature”get length():
number
Metres from the start to the end, along the samples.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”frameAt()
Section titled “frameAt()”frameAt(
distance,into?):TrackFrame
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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
distance |
number |
into |
TrackFrame |
Returns
Section titled “Returns”frictionAt()
Section titled “frictionAt()”frictionAt(
distance,lateral):number
The 1/s its surface costs a grounded mover at distance along and
lateral across: none unless the track was built with friction.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
distance |
number |
lateral |
number |
Returns
Section titled “Returns”number
locate()
Section titled “locate()”locate(
point):object
The track coordinates of a world point: projected on the frame of the nearest sample, so the distance runs on between samples.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
point |
{ x: number; y: number; z: number; } |
point.x |
number |
point.y |
number |
point.z |
number |
Returns
Section titled “Returns”object
| Name | Type |
|---|---|
distance |
number |
lateral |
number |
pointAt()
Section titled “pointAt()”pointAt(
distance,lateral):Vector3
The world point distance along and lateral across, positive to
the right of the direction of travel.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
distance |
number |
lateral |
number |
Returns
Section titled “Returns”Vector3
zoneWeight()
Section titled “zoneWeight()”zoneWeight(
distance,zone):number
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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
distance |
number |
zone |
string |
Returns
Section titled “Returns”number