Vehicle Editor - Lights Debug
Visualizes spotlight and point light props on the active vehicle in the Vehicle Editor, drawing debug spheres, direction arrows, and labels in 3D.
Visualizes spotlight and point light props on the active vehicle in the Vehicle Editor, drawing debug spheres, direction arrows, and labels in 3D.
Module Exports
| Export | Type | Description |
|---|---|---|
M.menuEntry | string | "Lights Debug" - label in vehicle editor menu |
M.open | function | Opens the debug window |
M.onVehicleEditorRenderJBeams | hook | Draws light debug geometry each frame |
M.onUpdate | hook | Renders the ImGui controls window |
M.onSerialize | hook | Persists window open state |
M.onDeserialized | hook | Restores window open state |
Key Internals
| Variable | Type | Purpose |
|---|---|---|
windowOpen | BoolPtr | Tracks if the debug window is open |
spotLightDebugEnabled | BoolPtr | Toggle for spotlight visualization |
pointLightDebugEnabled | BoolPtr | Toggle for point light visualization |
zTestEnabled | BoolPtr | Enables X-ray mode (disables depth test) |
displayNames | BoolPtr | Shows function name labels at light positions |
displayAsUnitVectors | BoolPtr | Normalizes direction arrows to length 1 |
How It Works
The module iterates over all props in vEditor.vdata.props. For each prop whose mesh is "SPOTLIGHT" or "POINTLIGHT", it reads the live world transform, draws a colored sphere at the light position, and renders directional indicators:
- Spotlights - direction line + two arrow-head triangles (rotated 90° for dual-angle visibility)
- Point lights - solid sphere at position + transparent range sphere
Colors are derived from prop.lightColor (RGB 0–255 mapped to 0–1).
Lua Code Example
-- The module is loaded as a vehicle editor live extension
-- Registered via M.menuEntry = "Lights Debug"
-- Opening the window programmatically
extensions.editor_vehicleEditor_liveEditor_veLightsDebug.open()
-- The render hook draws debug geometry for all light props:
-- Spotlights get a direction arrow with two triangle heads
-- Point lights get a sphere showing their range
-- ImGui window exposes checkboxes:
-- "Spotlight Debug (SL)" - toggle spotlight visualization
-- "Pointlight Debug (PL)" - toggle point light visualization
-- "X-Ray Mode" - disable depth testing
-- "Display Names" - show function name labels
-- "Unit Vectors" - normalize direction arrows to length 1
-- Arrow heads use rotated quaternions for dual-angle visibility:
-- q1 = quatFromEuler(0, 0, math.pi * 11/12)
-- q2 = quatFromEuler(0, 0, -math.pi * 11/12)
-- q3 = quatFromEuler(0, math.pi / 2, 0)
-- Each spotlight arrow is drawn from two angles:
-- debugDrawer:drawTriSolid(tip, tip + q1*qDir*arrowHead + dir, tip + q2*qDir*arrowHead + dir, col)
-- debugDrawer:drawTriSolid(tip, tip + q1*q3*qDir*arrowHead + dir, tip + q2*q3*qDir*arrowHead + dir, col)
-- Point light range visualization:
-- debugDrawer:drawSphere(lightPos, 0.04, lightCol1) -- center dot
-- debugDrawer:drawSphere(lightPos, prop.lightRange, lightCol2) -- range sphere (alpha=0.1)
-- Serialization saves/restores windowOpen state
-- so the debug window persists across editor reloadsSee Also
- Adjustable Tech Car Tuner - Related reference
- Aero Debug - Related reference
- Crash Tester - Related reference
- World Editor Guide - Guide
JBeam Picker
Live editor app for interactively picking, inspecting, and monitoring nodes and beams in the 3D viewport - displays static JBeam data, live telemetry graphs, and supports text-based search.
Vehicle Editor - Node Triangle Self Collision Detector
Detects and visualizes nodes that are within collision radius of triangles they don't belong to, highlighting potential self-collision issues in JBeam vehicle data.