API ReferenceGE Extensionsgameplayrace
Race Pacenote
Object class representing a pacenote (audio/visual cue) along a race path. Pacenotes have a position, radius, directional normal, and associated text note. Used for co-driver callouts.
Object class representing a pacenote (audio/visual cue) along a race path. Pacenotes have a position, radius, directional normal, and associated text note. Used for co-driver callouts.
Constructor
local Pacenote = require('/lua/ge/extensions/gameplay/race/pacenote')
local pn = Pacenote(path, name, forceId)Public API
| Method | Signature | Returns | Description |
|---|---|---|---|
init | (path, name, forceId) | nil | Initializes pacenote with path reference, name, and optional forced ID |
setNormal | (normal) | nil | Sets directional normal (normalized); nil resets to (0,1,0) |
setManual | (pos, radius, normal) | nil | Sets manual position, radius, and normal |
setNavgraph | (navgraphName, fallback) | nil | Sets position from a navgraph node |
inside | (pos) | bool | Tests if a position is inside the pacenote sphere (and normal check) |
intersectCorners | (fromCorners, toCorners) | hit, t | Ray-sphere + ray-plane intersection for vehicle corners |
onSerialize | () | table | Serializes to JSON-ready table |
onDeserialized | (data, oldIdMap) | nil | Restores from serialized data |
drawDebug | (drawMode, clr, extraText) | nil | Renders debug visualization |
Internals
| Field | Type | Description |
|---|---|---|
path | Path | Reference to parent path object |
id | number | Unique identifier within the path |
name | string | Display name |
pos | vec3 | World position |
normal | vec3 | Directional normal vector |
radius | number | Trigger sphere radius |
note | string | Text content of the pacenote |
segment | number | Associated segment ID (-1 if unassigned) |
sortOrder | number | Sort order for display |
mode | string | "manual" or "navgraph" |
How It Works
- Pacenotes define trigger volumes (sphere + optional half-plane via normal) along a race path
inside()checks distance to center and optionally validates the position is on the correct side of the normal planeintersectCorners()tests vehicle wheel corner movement against the sphere using ray-sphere and ray-plane intersection for precise frame-accurate detection- Serialization preserves position, radius, normal, note text, and linked segment
Usage Examples
-- Create a pacenote
local pn = Pacenote(myPath, "Turn 3 Left")
pn:setManual(vec3(100, 200, 50), 15, vec3(1, 0, 0))
pn.note = "Left 3 tightens"
-- Check if vehicle is inside
if pn:inside(vehiclePos) then
-- trigger audio callout
end
-- Serialize for saving
local data = pn:onSerialize()Notes
- Part of the race path system alongside
pathnode,segment, andstartPosition - The
intersectCornersmethod uses both sphere intersection and plane intersection for directional pacenotes - Debug drawing uses rainbow coloring based on sort order
See Also
- Race Path - Related reference
- Race Pathnode - Related reference
- Race - Related reference
- Gameplay Systems Guide - Guide
Vehicle Conditions
Reference for vehicle-based unlock condition types used by the mission unlock system.
Race Path
Core class representing a complete race path. Contains sorted lists of pathnodes, segments, start positions, and pacenotes. Handles auto-configuration, AI path generation, serialization, and importing