RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Activity ManagerAudio Bank ManagerAudio Ribbon SystemBus Route ManagerCamera SystemCore Chat (IRC)Core CheckpointsCore Command HandlerCoupler Camera ModifierDevices (RGB Peripherals)Dynamic PropsEnvironmentFlowgraph ManagerForestFun StuffGame ContextGame StateGround Marker ArrowsGround MarkersHardware InfoHighscoresHotlappingInventoryJob SystemLap TimesLevelsLoad Map CommandMetricsMod ManagerMultiseatMultiseat CameraMulti SpawnOnlinePaths (Camera Paths)Quick Access (Radial Menu)Recovery PromptRemote ControllerReplayRepositoryRope Visual TestScheme Command ServerCore SnapshotCore SoundsCore TerrainTraffic SignalsTrailer RespawnVehicle Active PoolingVehicle Bridge (GE ↔ VLua Communication)Vehicle MirrorsVehicle PaintsCore VehiclesVehicle TriggersVersion UpdateWeather SystemWindows Console
Vehicle ColorsVehicle In-Place EditVehicle ManagerVehicle MirrorVehicle Part Management

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionscorevehicle

Vehicle Mirror

Manages vehicle mirror angle offsets with mouse interaction and per-config persistence.

Manages vehicle mirror angle offsets with mouse interaction and per-config persistence.


Overview

Extension: core_vehicle_mirror - Provides mirror angle adjustment for vehicles with mirror JBeam data. Supports mouse drag interaction from the UI, per-vehicle/per-config persistence to mirrorOffsets.json, and an ImGui debug window. Can focus the driver camera on a specific mirror.


Dependencies

ui_imgui


Public Functions

FunctionDescription
M.getAnglesOffset(vid, veh)Returns mirror data table with current angle offsets
M.setAngleOffset(mirrorName, x, z, veh, save)Sets mirror offset angles (degrees); optionally saves
M.vehicleEvent(evtType, vid, mirrorName)Handles onDown/onUp mouse events from UI
M.focusOnMirror(mirrorName)Rotates driver camera to look at the named mirror
M.setDebug(newValue)Opens/closes the ImGui debug window
M.onUpdate(dtReal, dtSim, dtRaw)Updates mouse interaction and renders debug window
M.onVehicleSpawned(vid, veh)Applies saved mirror offsets on spawn
M.onSettingsChanged()Updates screen ratio for mouse interaction
M.onSerialize() / M.onDeserialized(data)Persists window state
M.onExtensionLoaded()Loads saved offsets from disk

Mirror Data Structure

Returned by getAnglesOffset():

{
  ["mirror_mesh_name"] = {
    name = "mirror_mesh_name",
    id = 0,                    -- mirror ID in vehicle
    angleOffset = {x=0, z=0},  -- current offset in degrees
    clampX = {-20, 20},        -- pitch clamp range
    clampZ = {-20, 20},        -- yaw clamp range
    position = ...,            -- UI column position
    icon = "...",              -- UI icon
    row = ...,                 -- UI row
    label = "..."              -- Display label
  }
}

Persistence

Offsets saved to /settings/mirrorOffsets.json keyed by:

offsetData[vehicleJBeam][configName][mirrorMeshName] = {x=degrees, z=degrees}

Hooks

HookPurpose
M.onVehicleDestroyedCalled on VehicleDestroyed event
M.dependenciesTable. Required extensions: {'ui_imgui'}
M.onClientEndMission()Hook: mission ended, cleans up mirror state.
M.onExtensionUnloaded()Hook: extension unloaded, cleans up.

Module State

VariableTypeDefault
dependenciestable{"ui_imgui"}
onExtensionUnloadednilAssigned but no local implementation (no-op)
onClientEndMissionnilAssigned but no local implementation (no-op)

Usage Examples

-- Get all mirror offsets for player vehicle
local mirrors = core_vehicle_mirror.getAnglesOffset()

-- Adjust a mirror
core_vehicle_mirror.setAngleOffset('mirror_left', 5, -3, nil, true)

-- Focus camera on right mirror
core_vehicle_mirror.focusOnMirror('mirror_right')

See Also

  • Vehicle Manager - Vehicle data access

Vehicle Manager

Central vehicle lifecycle manager: spawning, loading, physics, colors, and data access.

Vehicle Part Management

Manages vehicle part configurations - saving/loading `.pc` files, highlighting/selecting parts in the UI, and merging config changes (parts, vars, paints) into the active vehicle.

On this page

OverviewDependenciesPublic FunctionsMirror Data StructurePersistenceHooksModule StateUsage ExamplesSee Also