Rally Driveline Point List
Container class for a series of points along a rally driveline path. Provides point creation, relationship management, normal calculation, length computation, nearest-point search, and debug rendering
Container class for a series of points along a rally driveline path. Provides point creation, relationship management, normal calculation, length computation, nearest-point search, and debug rendering.
Constructor
local PointList = require('/lua/ge/extensions/gameplay/rally/driveline/pointList')
local pl = PointList(points)Public API
| Method | Signature | Returns | Description |
|---|---|---|---|
init | (points) | nil | Initializes with optional array of points |
createPoint | (pos, quat, ts) | table | Creates a new point with standard format |
setupPointRelationships | () | nil | Sets prev/next links and IDs for all points |
setupPointNormals | () | nil | Calculates terrain-aligned normals for all points |
calculateLength | () | number | Returns total path length in meters |
count | () | number | Number of points |
get | (index) | table | Point at index |
getAll | () | table | All points array |
setAll | (points) | nil | Replaces all points and rebuilds relationships/normals |
findNearestPoint | (srcPos) | table/nil | Brute-force nearest point by squared distance |
downsample | () | self | Stub - returns self (DrivelineV3 handles simplification) |
drawDebug | (drawLabels) | nil | Renders points as spheres with optional labels |
Internals
Point Structure
Each point contains:
| Field | Type | Description |
|---|---|---|
pos | vec3 | World position |
quat | quat | Rotation quaternion |
ts | number | Timestamp |
normal | vec3 | Forward-facing terrain normal |
prev | table/nil | Previous point reference |
next | table/nil | Next point reference |
id | number/nil | Sequential index |
partition | any | Optional partition data |
pacenoteDistances | table | Distance cache for pacenotes |
cachedPacenotes | table | Cached pacenote references (cs, ce, at, auto_at, half) |
How It Works
- Points form a doubly-linked list via
prev/nextreferences setupPointRelationships()assigns sequential IDs and linkssetupPointNormals()computes terrain-aligned normals usingsnaproadNormals.forwardNormalVeccalculateLength()sums distances between consecutive pointsfindNearestPoint()performs O(n) brute-force search (suitable for moderate point counts)
Usage Examples
-- Create a point list from positions
local points = {}
for i, pos in ipairs(positions) do
table.insert(points, {pos = pos, quat = quat(0,0,0,1), ts = i})
end
local pl = PointList(points)
pl:setupPointRelationships()
pl:setupPointNormals()
-- Query length
local totalLen = pl:calculateLength()
-- Find nearest point to a position
local nearest = pl:findNearestPoint(vehiclePos)Notes
- Uses
gameplay/rally/snaproad/normalsfor terrain-aware normal calculation - Debug rendering uses colors from
gameplay/rally/util/colors - The
downsample()method is a no-op stub for compatibility with older code cachedPacenotesfields are used by the rally system to track per-point pacenote proximity
See Also
- Rally Driveline Measurement - Related reference
- Rally Driveline Route - Related reference
- Rally Driveline V3 - Related reference
- Gameplay Systems Guide - Guide
Rally Driveline V3
Third-generation driveline system for rally stages. Loads recorded driveline data from recce sessions, simplifies it using RDP algorithm, generates smooth Catmull-Rom splines, and produces final drive
Rally Driveline Utility
Utility constants for the rally driveline spline system. Provides default values for spline width, RDP simplification tolerance, and subdivision parameters.