Race Debug
Provides debug visualization for race waypoints and paths. Draws waypoint spheres and route prisms in the 3D world when editor mode and debug setting are enabled.
Provides debug visualization for race waypoints and paths. Draws waypoint spheres and route prisms in the 3D world when editor mode and debug setting are enabled.
Public API
| Function | Signature | Description |
|---|---|---|
M.onScenarioChange | (scenario) | Builds debug path by computing routes between waypoints |
M.onDrawDebug | (focusPos) | Renders waypoint spheres and path prisms when debug enabled |
Internals
Path Building (onScenarioChange)
- Gets the current scenario's
lapConfigwaypoint list - For each consecutive pair of waypoints, calls
map.getPath(from, to) - Stores the resulting path nodes in
scenario.debugPath - Copies node data (position, radius) into
scenario.debugNodes - Marks nodes as
directif the path segment is a single hop
Debug Drawing (onDrawDebug)
Only draws when both:
$isEditorEnabled == 1(editor mode active)settings.getValue("BeamNGRaceDrawDebug")is true
Renders:
- Red spheres at each lap config waypoint with its radius
- Text labels showing waypoint index (e.g., "wp 3/12")
- Green square prisms connecting debug path nodes (route visualization)
- Red prisms for direct connections (no intermediate road nodes)
How It Works
onScenarioChangetriggers when a scenario starts running- Iterates through
lapConfigwaypoints and finds road-level paths between them onDrawDebugis called each frame by the debug draw system- Uses
debugDrawerto render spheres, text, and square prisms along the route
Usage Examples
-- Enable race debug visualization
-- 1. Enter editor mode (F11)
-- 2. Enable the setting:
settings.setValue("BeamNGRaceDrawDebug", true)
-- The debug overlay will appear automatically during any running scenarioKey Notes
- Debug-only tool - has no effect on gameplay
- Uses
map.getPathfor road-level pathfinding between waypoints - Square prisms width scales with waypoint radius
- Direct connections (single-hop paths) drawn in red vs green for routed paths
- Path data stored on the scenario object itself (
scenario.debugPath,scenario.debugNodes)
See Also
- Scenario Bus Driver - Bus Route Scenario Logic - Related reference
- Scenario Damage Goal - Damage-Based Win/Fail Condition - Related reference
- Scenario Demolition Derby - Last Vehicle Moving Wins - Related reference
- Scenario System Guide - Guide
Race Markers
Central manager for all race checkpoint markers. Creates, pools, positions, and updates marker objects. Supports swappable marker types and delegates rendering to individual marker instances.
Race Goals Manager
Central manager that initializes, validates, and dispatches race goal events to individual goal modules. Acts as the bridge between the scenario system and goal implementations.