Script AI Editor
Full-featured editor for creating, editing, and executing scriptAI vehicle trajectories and camera paths - supports time-based and speed-based scripts, spline interpolation, drawing mode, recording, u
Full-featured editor for creating, editing, and executing scriptAI vehicle trajectories and camera paths - supports time-based and speed-based scripts, spline interpolation, drawing mode, recording, undo/redo, and session save/load.
Public API (Key Functions)
| Function | Signature | Description |
|---|---|---|
M.onEditorGui | () | Main editor GUI for all tool windows |
M.onEditorInitialized | () | Registers the "Edit ScriptAI Scenario" edit mode and all windows |
M.onSerialize / M.onDeserialized | () / (data) | Session persistence for trajectories, camera, and window states |
M.onVehicleSubmitRecording | (vid, data) | Callback for vehicle submit recording event |
M.onVehicleReplaced | (vid) | Callback for vehicle replaced event |
Key Features
- Vehicle trajectories: Create paths with time-stamps or speed values per node
- Camera path: Independent camera trajectory with position, rotation, and smoothness per node
- Recording: Record vehicle movements in real-time and convert to trajectories
- Draw mode: Click to place nodes on terrain with freehand drawing
- Spline mode: Optional Catmull-Rom interpolation of polylines
- Execution: Synchronized playback of all vehicle trajectories + camera path
- Timeline: Scrubable time slider with play/pause/rewind/fast-forward
- Import/Export: Single trajectory JSON files (compatible with standard scriptAI format)
- Session save/load: Full session persistence with vehicle spawning
Windows
| Window | Purpose |
|---|---|
scriptAIEditor | Main timeline/transport controls |
scriptAIEditor_VehWin | Vehicle list with recording controls |
scriptAIEditor_TrajListWin | Trajectory list and management |
scriptAIEditor_TrajWin1/2/3 | Individual trajectory node editors (3 max) |
scriptAIEditor_CamWin | Camera path editor with position/rotation/smoothness |
scriptAIEditor_DrawWin | Freehand drawing mode controls |
Trajectory Data Structure
local trajectory = {
vehicle = "vid: name - jBeam",
vid = vehicleId,
jBeam = "pickup",
isTimeBased = true, -- false = speed-based
polyLine = { { x=im.FloatPtr(0), y=im.FloatPtr(0), z=im.FloatPtr(0), t=im.FloatPtr(0) }, ... },
spline = nil, -- optional Catmull-Rom spline
isExternalForce = true, -- AI assistance
isHoldVelocity = true,
col = im.ArrayFloat(3), -- display color
}Notes
- Uses gizmo for translating/rotating camera path nodes
- Velocity visualization uses colored debug lines
- Lock feature prevents node time/position from being modified
- Supports both looping and one-shot playback
See Also
- Editor AI Tests - Related reference
- Editor AI Visualization - Related reference
- Editor – Assembly Spline Tool - Related reference
- World Editor Guide - Guide
Screenshot Creator Bootstrap
Minimal bootstrap module that adds a "Vehicle Screenshot Creator" menu item to the editor, delegating to `util_screenshotCreator`.
Script AI Manager
Editor window for managing scriptAI recordings across all vehicles - supports recording, playback, looping, save/load of track files, and real-time progress visualization.