Map Sensor Editor
Editor tool for placing and configuring map-attached sensors (Camera, LiDAR, Ultrasonic, RADAR). Requires `Research` build flag. Provides full ImGui UI for sensor management, live/edit mode toggling,
Editor tool for placing and configuring map-attached sensors (Camera, LiDAR, Ultrasonic, RADAR). Requires Research build flag. Provides full ImGui UI for sensor management, live/edit mode toggling, Python code export, and gizmo-based pose adjustment.
Public API
| Function | Signature | Description |
|---|---|---|
M.onEditorGui | () | Main editor GUI callback; renders tool, sensor properties, and camera preview windows |
M.onEditorInitialized | () | Registers editor windows and edit mode |
M.onSerialize | () → table | Serializes sensor configuration |
M.onDeserialized | (dataIn) | Restores sensor configuration from serialized data |
M.onSensorCreated | (sensorType, sensorId) | Hook called when a sensor is created |
M.onSensorRemoved | (sensorType, sensorId) | Hook called when a sensor is removed |
Internal Functions
| Function | Description |
|---|---|
gizmoBeginDrag() | Captures rotation state at start of axis gizmo drag |
gizmoDragging() | Handles translation/rotation during gizmo drag |
handleGimbals(pos) | Sets up and draws the axis gizmo for sensor pose adjustment |
handleFinishPlacingSensor(pos) | Creates a new sensor at the given world position |
handleEditLiveModeSwitch(idx) | Toggles a sensor between edit and live streaming mode |
handlePlaceSensor() | Raycasts to terrain and places sensor on mouse click |
removeSensor(idx) | Removes a sensor and cleans up its live state |
saveConfiguration() | Saves sensor config to JSON via file dialog |
loadConfiguration() | Loads sensor config from JSON via file dialog |
manageMainToolWindow() | Renders the main sensor list with add/remove/edit/live buttons |
manageCameraPreviewWindow(dt) | Renders live camera preview for selected camera sensor |
manageSensorPropWindow() | Renders per-sensor property editor (position, resolution, FOV, etc.) |
Key Concepts
- Sensor Types: Camera, LiDAR, Ultrasonic, RADAR - each with dedicated property UI
- Edit vs Live Mode: Sensors can be toggled between editable (gizmo) and streaming (live data)
- Python Export: Generates BeamNGpy-compatible Python code for the current configuration
- Beam Presets: Ultrasonic and RADAR sensors have beam shape presets (triangular, bulb, spherical, etc.)
Usage Example
-- This is an editor extension; activate via the editor toolbar
-- Sensors are placed by clicking "Add Camera/LiDAR/Ultrasonic/RADAR"
-- then clicking on the terrain to position them.
-- Configurations are saved/loaded as JSON files.Dependencies
editor/tech/sensorConfiguration/utilitieseditor/tech/sensorConfiguration/conversionstech/techUtilsextensions.tech_sensorsextensions.tech_pythonExportextensions.tech_cameraPreview
Functions
onSerialize()
Callback for serialize event.
Returns: table
onDeserialized(dataIn)
Callback for deserialized event.
dataIn(any)
onSensorCreated(sensorType, sensorId)
Callback for sensor created event.
sensorType(any)sensorId(any)
onSensorRemoved(sensorType, sensorId)
Callback for sensor removed event.
sensorType(any)sensorId(any)
Returns: self
See Also
- Editor AI Tests - Related reference
- Editor AI Visualization - Related reference
- Editor – Assembly Spline Tool - Related reference
- World Editor Guide - Guide
Editor Main Update
Core per-frame update loop for the editor. Drives edit mode updates, object icon rendering, preference broadcasting, gizmo rendering, GUI presentation, and collision rebuild checks.
Master Spline Editor
Main editor tool for the Master Spline system - a parametric road/spline editor with multi-layer linking (mesh, assembly, decal, road splines), auto banking, terrain conforming, road design homologati