RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

server/commands - Camera & Input Commandsge_utils - Game Engine Utility Functionsmain.lua - GE Lua Entry Point & Game Loopmap.lua - Navigation Graph (AI Road Map)screenshot.lua - Screenshot Systemserver/server - Level Loading & Game ServerserverConnection - Client-Server Connection Manager`setSpawnpoint` - Default Spawn Point Persistence`simTimeAuthority` - Simulation Time & Bullet Time Control`spawn` - Vehicle Spawning & Safe Placement`suspensionFrequencyTester` - Suspension Natural Frequency Analysis
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

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 Extensionscore

Coupler Camera Modifier

Adjusts orbit camera distance and target when two vehicles are coupled (e.g. truck + trailer), centering the view between them. Automatically restores original camera settings on detach or when vehicl

Adjusts orbit camera distance and target when two vehicles are coupled (e.g. truck + trailer), centering the view between them. Automatically restores original camera settings on detach or when vehicles move apart.


Public API

FunctionSignatureDescription
M.checkForTrailer(objId1, objId2) → boolReturns true if the player vehicle is one of the two objects and they are within coupling distance (1–15 m).
M.onCouplerAttached(objId1, objId2)Hook: validates trailer pair, saves original camera distances, locks orbit cameras, and sets combined distance.
M.onCouplerDetached(objId1, objId2)Hook: restores original orbit camera distances and clears coupling state.
M.onVehicleSpawned(vehId)Hook: if a coupled vehicle is respawned/replaced, triggers detach cleanup.
M.onUpdate()Per-frame: recalculates mean reference position between coupled vehicles and feeds it to core_camera. Auto-detaches when distance exceeds sum of original distances.
M.onSerialize() → tableSaves coupling state for hot-reload.
M.onDeserialized(data)Restores coupling state from serialized data.

How It Works

  1. Attach - onCouplerAttached validates the pair via checkForTrailer, then locks both orbit cameras to a shared distance (d1+d2)/1.5+1.
  2. Frame update - onUpdate computes a midpoint between both vehicles' reference nodes and offsets, then calls core_camera.setRef so the orbit pivots around the combo.
  3. Detach / distance - if vehicles separate beyond original distance sum, or onCouplerDetached fires, cameras unlock and revert.

Usage Example

-- Typically driven by engine hooks; manual test:
if core_couplerCameraModifier.checkForTrailer(truckId, trailerId) then
  log('I', 'test', 'Trailer detected, camera will auto-adjust')
end

Key Internals

  • Uses core_camera.getCameraDataById(id).orbit for per-vehicle orbit data.
  • Reference nodes (ref, left, back) build a local coordinate frame for offset calculations.
  • detached flag prevents redundant restore calls.

Core Command Handler

Handles `beamng:` URL scheme commands for mod management, map loading, toolchain, debugger control, and other async tasks triggered via protocol URLs or startup arguments.

Devices (RGB Peripherals)

Manages RGB lighting on supported peripherals (e.g. keyboards, mice). Sets the BeamNG orange brand color when switching to non-drivable entities (unicycle, props, no vehicle) and resets to vehicle-dri

On this page

Public APIHow It WorksUsage ExampleKey Internals