Skip to content

Track Splines

Harry Bosch edited this page Aug 21, 2023 · 1 revision

Closest Points and Arc Length

Arc length and closest point calculation are done on a rasterized version of the spline. This rasterized version is a large list of connected line segments that remains consistent over every evaluation. The resolution of this list can be changed via the editor.

Arc length is simply the sum of the length of these line segments.

Closest point find the closest point in the list and the point after it, then calculates a percent along the spline based on an interpolated value between the said two points.


Knots

Local knots are a collection of points stored in object space by the spline. These can be moved in the editor via some custom tooling.

When knots are accessed, they are converted to world space, and additional knots are inserted depending on connections with other splines, resulting in automatic continuity between custom splines.


Sampling

The track is sampled as a Catmull-Rom cubic spline, the t value in is between 0 and 1.

If the track is set to loop, values outside of 0 and 1 will loop around the track.


Clone this wiki locally