Vehicle Editor - Powertrain Inspector
Displays live powertrain device data and JBeam definitions for the active vehicle in the Vehicle Editor, allowing inspection of engines, transmissions, and other drivetrain components.
Displays live powertrain device data and JBeam definitions for the active vehicle in the Vehicle Editor, allowing inspection of engines, transmissions, and other drivetrain components.
Module Exports
| Export | Type | Description |
|---|---|---|
M.menuEntry | string | "Powertrain Inspector" - menu label |
M.dependencies | table | {"editor_veMain"} |
M.open | function | Opens the powertrain inspector window |
M.onUpdate | hook | Renders ImGui window with device data |
M.onSerialize | hook | Saves window and device selection state |
M.onDeserialize | hook | Restores state |
M.onVehicleSwitched | hook | Refreshes device list on vehicle change |
M.onEditorActivated | hook | Refreshes device list when editor activates |
Key Internals
| Variable | Type | Purpose |
|---|---|---|
windowOpen | BoolPtr | Window visibility toggle |
devicePtr | IntPtr | Currently selected device index in combo box |
deviceNames | table | Sorted list of powertrain device names |
deviceString | string | Null-separated device names for ImGui combo |
How It Works
- Queries vehicle Lua for serialized powertrain device info via
queueLuaCommand - Builds a sorted combo box of device names from
vEditor.powertrainDevices - For the selected device, shows:
- JBeam Data - from
vEditor.vdata.powertrainviapowerTrainUtils.showJbeamData() - Live Data - from serialized device info via
powerTrainUtils.displayLivedata()andpowerTrainUtils.displayLivedataByType()
- JBeam Data - from
Lua Code Example
-- Open powertrain inspector
extensions.editor_vehicleEditor_liveEditor_vePowerTrain.open()
-- The module queries vehicle-side Lua each frame:
-- vEditor.vehicle:queueLuaCommand([[
-- obj:queueGameEngineLua("vEditor.powertrainDevices ="
-- .. powertrain.serializeDevicesInfo())
-- ]])
-- Device names are collected and sorted alphabetically:
-- local deviceNamesUnsorted = {}
-- for _, device in ipairs(vEditor.powertrainDevices) do
-- deviceNamesUnsorted[device.name] = 0
-- end
-- local keys = tableKeysSorted(deviceNamesUnsorted)
-- JBeam data is shown for matching powertrain entries:
-- for lpid = 0, #vEditor.vdata.powertrain - 1 do
-- if deviceNames[devicePtr[0]+1] == vEditor.vdata.powertrain[lpid].name then
-- powerTrainUtils.showJbeamData(lpid)
-- end
-- end
-- Live data tree displays real-time device state:
-- powerTrainUtils.displayLivedata(device)
-- powerTrainUtils.displayLivedataByType(device.type, device)
-- When vehicles are switched, the device string is refreshed:
-- vEditor.vehicle:queueLuaCommand(
-- 'obj:queueGameEngineLua("vEditor.resetDeviceString = true")')
-- Uses powerTrainUtils from editor/vehicleEditor/api/powerTrainUtils
local powerTrainUtils = require("editor/vehicleEditor/api/powerTrainUtils")See Also
- Adjustable Tech Car Tuner - Related reference
- Aero Debug - Related reference
- Crash Tester - Related reference
- World Editor Guide - Guide
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.
Vehicle Editor - Prop Transformer
Interactive tool for picking, inspecting, and transforming vehicle props (meshes, lights) in 3D using axis gizmos, with support for translation and rotation in both local and global coordinate spaces.