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
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 either Free Mode (script path) or NavGraph Mode (waypoint target list).
Public API
| Function | Signature | Description |
|---|---|---|
M.getPlaybackTime | () → number | Returns total elapsed playback time in seconds |
M.startPlayback | (splines, vehicles) | Initializes playback: builds playing table from linked pairs, resets vehicle poses |
M.stopPlayback | () | Stops AI for all playing vehicles, resets to starting positions |
M.handlePlayback | () | Per-frame update: checks delay times, issues AI commands when ready |
Playback Flow
startPlayback(splines, vehicles)
→ Build playing table { [vid] = {spline, vehicle, isStarted} }
→ Reset all vehicles to starting positions
→ Reset timers
handlePlayback() (called each frame)
→ For each vehicle not yet started:
if elapsed time >= spline.delayTime:
→ Build AI command based on mode
→ Queue vLua command
→ Mark as started
→ Update timers
stopPlayback()
→ ai.setState({mode = "stop"}) for all
→ Reset vehicle poses
→ Clear playing tableAI Command - Free Mode
ai.driveUsingPath{
script = { {x,y,z, r=width, v=vel, vl=velLimit}, ... },
routeSpeed = 31.3,
routeSpeedMode = "set", -- or "limit"
avoidCars = "on",
driveInLane = "on",
aggression = 0.3,
noOfLaps = nil -- or number for loops
}AI Command - NavGraph Mode
ai.driveUsingPath{
wpTargetList = {"node1", "node2", ...},
wpSpeeds = {node1 = vel1, node2 = vel2, ...},
routeSpeed = 31.3,
routeSpeedMode = "set",
...
}Dependencies
| Module | Purpose |
|---|---|
editor/drivePathEditor/splineMgr | resetVehiclePose(), spline data access |
editor/toolUtilities/geom | Catmull-Rom interpolation for Free Mode |
editor/toolUtilities/rdp | RDP simplification of playback nodes (tol=1.0) |
See Also
- Drive Path Editor - Record - Related reference
- Drive Path Editor - Spline Manager - Related reference
- World Editor Guide - Guide
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.
Drive Path Editor - Record
Records a vehicle's driven path into a new drive path spline. Samples position and velocity at a fixed interval, deduplicates close nodes, applies RDP simplification, and links the result to the recor