Drag Race Editor - Waypoints
Manages standalone drag race waypoint data: loading, selecting, adding (spawn/stage/endLine), removing, saving, and ImGui UI for waypoint editing with transform gizmos and world-space preview.
Manages standalone drag race waypoint data: loading, selecting, adding (spawn/stage/endLine), removing, saving, and ImGui UI for waypoint editing with transform gizmos and world-space preview.
Public API
| Function | Signature | Description |
|---|---|---|
M.loadAllWaypoints | () | Loads all waypoints from dragSaveSystem.getAllWaypoints() |
M.getAllWaypoints | () → table | Returns loaded waypoints array |
M.getSelectedWaypointIndex | () → number | Returns selected waypoint index |
M.setSelectedWaypointIndex | (index) | Sets selected waypoint index |
M.getSelectedWaypoint | () → table|nil | Returns selected waypoint or nil |
M.selectWaypoint | (index) | Selects a waypoint by index |
M.addWaypoint | (waypointType) | Creates new waypoint (default "stage"), selects it |
M.removeSelectedWaypoint | () | Removes selected waypoint, adjusts selection |
M.saveWaypoint | (waypoint) → bool | Saves waypoint JSON to level drag path |
M.drawWaypointsSection | () | ImGui child panel: Add Spawn/Stage/End Line buttons, list, remove/save |
M.drawWaypointDetails | () | ImGui child panel: type combo, transform editor |
M.drawWaypointsPreview | () | Debug draws selected waypoint sphere and label in world |
Waypoint Data Structure
{
type = "stage", -- "stage" | "endLine" | "spawn"
transform = {
position = { x = 0, y = 0, z = 0 },
rotation = { x = 0, y = 0, z = 0, w = 1 },
scale = { x = 1, y = 1, z = 1 }
}
}Usage Example
local waypoints = require('editor/dragRaceEditor/waypoints')
waypoints.loadAllWaypoints()
waypoints.addWaypoint("spawn")
-- Draw in editor
waypoints.drawWaypointsSection()
waypoints.drawWaypointDetails()
waypoints.drawWaypointsPreview()Dependencies
| Module | Purpose |
|---|---|
editor/dragRaceEditor/constants | Color constants for rendering |
editor/dragRaceEditor/state | Shared search, transforms, mouse info |
editor/dragRaceEditor/utils | markUnsavedChanges(), setupTransform() |
gameplay/drag/saveSystem | Waypoint file I/O |
ui_imgui / ffi | ImGui widgets |
See Also
- Drag Race Editor Constants - Related reference
- Drag Race Editor - Drag Settings - Related reference
- Drag Race Editor - Facilities - Related reference
- World Editor Guide - Guide
Drag Race Editor - Utils
Utility functions for the drag race editor: error display, undo/redo stack, data validation, lane creation, mouse info tracking, and transform setup.
Drive Path Editor - Playback
Handles AI playback of all linked drive path splines/vehicles. Starts vehicles at their spline's starting node, waits for each spline's delay time, then commands AI driving via `ai.driveUsingPath` in