Pacenote Waypoint
Class representing a waypoint within a pacenote. Each pacenote has typically two waypoints: a Corner Start (CS) and Corner End (CE). Waypoints define 3D positions with normals for intersection planes
Class representing a waypoint within a pacenote. Each pacenote has typically two waypoints: a Corner Start (CS) and Corner End (CE). Waypoints define 3D positions with normals for intersection planes and radii for trigger detection.
Constructor
local PacenoteWaypoint = require('gameplay/rally/notebook/pacenoteWaypoint')
local wp = PacenoteWaypoint(pacenote, name, pos, forceId)Public API
| Method | Signature | Returns | Description |
|---|---|---|---|
init | (pacenote, name, pos, forceId) | nil | Initializes with auto-detected waypoint type |
setManual | (pos, radius, normal) | nil | Sets mode to "manual" with explicit geometry |
setPos | (newpos) | nil | Updates position |
setNormal | (normal) | nil | Updates normal (normalized if length > 0.9) |
onSerialize | () | table | Returns {oldId, name, waypointType, pos, radius, normal} |
onDeserialized | (data, oldIdMap) | nil | Restores from saved data via setManual |
colorForWpType | (pn_drawMode) | table | Returns color array based on waypoint type and draw mode |
drawDebug | (hover, text, clr, ...) | nil | Draws sphere + text + intersection plane |
drawDebugRecce | (i, noteText) | nil | Draws recce-mode visualization with gate posts |
isCs | () | boolean | True if Corner Start type |
isCe | () | boolean | True if Corner End type |
isLockable | () | boolean | True for CS and CE types |
isLocked | () | boolean | True if editor lock preference is on |
setRoutePoint | (rp) | nil | Associates a dynamic route point for distance tracking |
setStaticRoutePoint | (rp) | nil | Associates a static route point |
nameWithPacenote | () | string | Returns "PacenoteName[CS]" or "[CE]" format |
Internals
Fields
| Field | Type | Default | Description |
|---|---|---|---|
pos | vec3 | constructor arg | World position |
normal | vec3 | (0,1,0) | Forward normal for intersection plane |
radius | number | editor pref or rallyUtil.default_waypoint_intersect_radius | Detection/display radius |
waypointType | string | auto-detected | wpTypeCornerStart or wpTypeCornerEnd |
mode | string | nil | "manual" when explicitly placed |
routePoint | object | nil | Dynamic route point for distance calculations |
staticRoutePoint | object | nil | Static route point reference |
Auto Type Detection
On creation, calls pacenote:getNextWaypointType() which checks existing waypoints:
- If no CS exists →
wpTypeCornerStart - If no CE exists →
wpTypeCornerEnd
Debug Drawing
Editor mode (drawDebug):
- Sphere at position with type-based color
- Text label with note content
- Square prism intersection plane perpendicular to normal
Recce mode (drawDebugRecce):
- Two vertical cylinders as "gate posts" on each side of the road
- Horizontal crossbar connecting posts
- Translucent drive-through plane
- Note text floating above
Color System
Colors vary by draw mode (selected, previous, next, background):
- CS waypoints: green variants
- CE waypoints: blue variants
- Uses
cc(colors) module from rally utilities
How It Works
- Created by pacenote's
pacenoteWaypointssorted list - Position and normal define an intersection plane across the road
- During gameplay, route points are attached for distance-to-target calculations
- In the editor, drawn as spheres with intersection planes
- In recce mode, drawn as gate-like structures the driver passes through
Usage Example
-- Create waypoints for a pacenote
local wp_cs = pacenote.pacenoteWaypoints:create('corner start', vec3(100, 200, 50))
local wp_ce = pacenote.pacenoteWaypoints:create('corner end', vec3(120, 210, 50))
-- Set normal from snaproad
local normalVec = snaproad:forwardNormalVec(snapPoint)
wp_cs:setNormal(normalVec)
-- Check type
if wp:isCs() then
-- corner start logic
endSee Also
- Rally Codriver - Related reference
- Rally Mission Settings - Related reference
- Rally Pacenote - Related reference
- Gameplay Systems Guide - Guide
Pacenote Generator
Simplified corner detection system that generates pacenotes from driveline points. Analyzes road geometry using circle-fitting to identify direction changes, then groups consecutive nodes into corners
Notebook Path
Core class representing a rally notebook - the container for pacenotes, codrivers, and all rally authoring data. Manages saving/loading from JSON, codriver selection, audio mode, pacenote generation,