Drag Race Debug
Reference for `gameplay_drag_debug`, which provides an ImGui debug window for inspecting and controlling drag race state. Displays race data, vehicle assignments, lane data, phase progression, and veh
Reference for gameplay_drag_debug, which provides an ImGui debug window for inspecting and controlling drag race state. Displays race data, vehicle assignments, lane data, phase progression, and vehicle-specific details.
Overview
This extension renders a comprehensive ImGui debug interface for drag racing development. It shows the current drag race state, allows adding/removing vehicles to lanes, starting/resetting races, and inspecting per-vehicle phase data.
Dependencies
ui_imgui
Exports
| Function | Signature | Description |
|------
| M.aviableLanes | any | aviableLanes |
| M.selectedVehicle | any | selectedVehicle |----|-----------|-------------|
| onUpdate | (dtReal, dtSim, dtRaw) | Render the debug menu each frame |
| drawDebugMenu | (dragData, ext) | Main ImGui drawing function |
| setDebugMenu | (enabled) | Enable/disable the debug window |
| getDebugMenu | () | Check if debug window is enabled |
| setSelectedVehicle | (vehId) | Set the selected vehicle for detail view |
| getSelectedVehicle | () | Get the currently selected vehicle |
| setAviableLanes | (lanes) | Set available lane data |
| getAviableLanes | () | Get available lane data |
| getSelection | (classNames) | Get the editor-selected object ID |
| selectElement | (index) | Select a vehicle by index |
| getLastElement | (dragData) | Select the last racer in the data |
Debug Window Layout
The window is organized in a multi-column layout:
Left Column - Drag Data
- Context - Current drag race context string
- Extension - Active drag type extension name (green/red status)
- Is Started - Race started status
- Phases - Buttons to play individual race phases
- Prefabs - Listed prefab usage status and paths
- Buttons: Start Drag Race, Reset Drag Race, Clear Save Data
Right Column - Strip Data
- End Camera - Position, rotation, scale of the end camera
- Prefab details - Which prefabs are in use
Vehicle Select Panel
- Empty lanes - Click to assign the editor-selected vehicle to a lane
- Racer list - Click to select a racer for detail view
Vehicle Detail Panel
- Remove Vehicle button
- Lane Data - Click to dump lane transform data, hover for 3D axis preview
- Vehicle Data - Playable status, lane, disqualification reason
- Phase progression - Each phase with started/completed status (green/red)
How It Works
-- Enable the debug menu
gameplay_drag_debug.setDebugMenu(true)
-- The debug menu auto-renders via onUpdate
-- It fetches data from gameplay_drag_general:
local dragData = gameplay_drag_general.getData()
local ext = gameplay_drag_general.getExtension()Editor Integration
getSelection() reads from the editor's selection state:
local vehId = gameplay_drag_debug.getSelection({"BeamNGVehicle"})
-- Returns the editor-selected vehicle ID if it matches the class filterWhen clicking an empty lane in the debug panel, the editor-selected vehicle is assigned to that lane via gameplay_drag_general.setupRacer().
Visual Indicators
| Color | Meaning |
|---|---|
| Green | Active/started/completed/has extension |
| Red | Inactive/not started/not completed/no extension |
| Yellow | Warning states |
Lane data hover visualization uses editor_dragRaceEditor.drawAxisBox() for 3D preview with RGB axis lines.
Key Behaviors
- The debug menu sources all data from
gameplay_drag_general.getData()and.getExtension() - Phase buttons call
ext.startDebugPhase(index, dragData)to jump to specific race phases - Vehicle playable status can be toggled via checkbox
- Lane assignment removes the empty lane option and shows the vehicle in the racer list
- Vehicle removal restores the empty lane
- The
onUpdatehook only runs whendebugMenuis true
Module Variables
| Variable | Type | Description |
|---|---|---|
M.selectedVehicle | any | selectedVehicle |
M.aviableLanes | any | aviableLanes |
M.debugMenu | value | - |
M.drawDebugMenu | (dragData, ext) | - |
M.getAviableLanes | () | - |
M.getDebugMenu | () | - |
M.getLastElement | (dragData) | - |
M.getSelectedVehicle | () | - |
M.getSelection | (classNames) | - |
M.onUpdate | (dtReal, dtSim, dtRaw) | - |
M.selectElement | (index) | - |
M.setAviableLanes | (lanes) | - |
M.setDebugMenu | (enabled) | - |
M.setSelectedVehicle | (vehId) | - |
See Also
- drag/display - Christmas Tree & Display Signs - Related reference
- drag/dragBridge - Flowgraph / External API Bridge - Related reference
- drag/general - Core Drag Race Manager - Related reference
- Gameplay Systems Guide - Guide
Junkyard
Reference for `gameplay_discover_038_junkyard`. This file exists in the discover/038 subdirectory but was found to be empty (no content).
Drag Tree Display
Reference for `gameplay_drag_display`, which controls the visual Christmas tree lights and digital display signs on the drag strip, plus corresponding UI updates.