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.
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.
Module Exports
| Export | Type | Description |
|---|---|---|
M.menuEntry | string | "Prop Transformer" - menu label |
M.open | function | Opens the prop transformer window |
M.onVehicleEditorRenderJBeams | hook | Renders prop picking and transform gizmos |
M.onUpdate | hook | Renders ImGui window with transform controls |
M.onVehicleSwitched | hook | Reinitializes state for new vehicle |
M.onVehicleSpawned | hook | Clears and reinitializes on respawn |
M.onSerialize | hook | Persists window state |
M.onDeserialized | hook | Restores window state |
Key Internals
| Variable | Type | Purpose |
|---|---|---|
windowOpen | BoolPtr | Window visibility |
states | table | Per-vehicle state (picked prop, mode, gizmo data) |
initStates | table | Per-vehicle initial state templates |
initVehDatas | table | Per-vehicle initial vehicle data snapshots |
dragging | boolean | Whether an axis gizmo drag is in progress |
State Template Fields
| Field | Type | Purpose |
|---|---|---|
mode | number | 1 = inspect, 2 = picking |
pickedProp | table/nil | Currently selected prop data |
propSelectorIdx | number | Mouse-scroll index for overlapping props |
hitPropRefNodes | table | Props whose ref nodes are under the cursor |
propertyEditing | string/nil | "baseTranslationGlobal" or "baseRotationGlobal" |
How It Works
Prop Picking (pickProp)
- Casts a ray from the mouse cursor
- Finds prop reference nodes within collision radius (0.035)
- When multiple props share a ref node, scroll wheel selects among them
- Left-click picks the highlighted prop
Prop Transforming (transformProp)
- Converts prop position from vehicle JBeam coords to world coords
- Sets up the editor axis gizmo at the prop's position
- Handles gizmo drag callbacks for translate/rotate modes
- Applies delta transforms via
propObj:setBaseTranslationGlobal()orpropObj:setBaseRotationGlobalQuat()
Rendering (renderPickedProp)
- Shows ref/X/Y node positions with colored spheres (white/red/green)
- Draws X/Y/Z axis lines from ref node
- For spotlights: direction arrow with triangle heads
- For point lights: range sphere
Lua Code Example
-- Open prop transformer
extensions.editor_vehicleEditor_liveEditor_vePropTransformer.open()
-- The picking flow:
-- 1. Click "Pick Prop" button -> enters mode 2
-- 2. Hover over prop ref nodes (green spheres drawn at initial positions)
-- 3. Scroll wheel selects among overlapping props
-- 4. Left-click picks the prop
-- Transform uses editor axis gizmo:
-- editor.setAxisGizmoMode(editor.AxisGizmoMode_Translate)
-- state.propertyEditing = "baseTranslationGlobal"
-- Gizmo callbacks handle delta computation:
-- gizmoBeginDrag: stores initial position/rotation
-- gizmoDragging: computes delta from gizmo transform
-- gizmoEndDrag: clears dragging flag
-- Position without node transforms is computed via:
-- local x, y, z, rx, ry, rz = utils.getPosRotBeforeNodeRotateOffsetMove(
-- prop, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z)
-- ImGui window shows editable float3 inputs for:
-- baseTranslation, baseTranslationGlobal, baseRotation, baseRotationGlobal
-- Plus "Copy to Clipboard" for JBeam-format values
-- Coordinate transform: vehicle coords -> world coords:
-- local rot = quatFromDir(-dirFront, dirUp)
-- local axisGizmoPos = rot * (baseTranslationJBeamCoords - refPos) + vehiclePos
-- State is maintained per-vehicle via initVehDatas[vehID]
-- Switching vehicles auto-initializes new state from vdata.propsSee Also
- Adjustable Tech Car Tuner - Related reference
- Aero Debug - Related reference
- Crash Tester - Related reference
- World Editor Guide - Guide
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.
Vehicle Editor - Raw Vehicle Data
Displays the complete raw vehicle data (`vEditor.vehData`) as a recursive tree in the Vehicle Editor.