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

Camera System

Central camera management system. Handles camera mode switching, per-vehicle camera configuration, global cameras, input routing, collision detection, shadow quality, serialization, and all camera-rel

Central camera management system. Handles camera mode switching, per-vehicle camera configuration, global cameras, input routing, collision detection, shadow quality, serialization, and all camera-related input bindings.


Public API - Camera Selection

FunctionSignatureReturnsDescription
M.setByName([player], camName, withTransition, customData)nilSets camera by name (global or per-vehicle)
M.setGlobalCameraByName(name, withTransition, customData)nilActivates a global camera (or nil to exit)
M.setVehicleCameraByNameWithId(vehId, name, withTransition, customData)booleanSets vehicle camera by vehicle ID
M.setBySlotId(player, slotId)nilSets camera by slot number (1-9 keys)
M.setVehicleCameraByIndexOffset(player, offset)nilCycles camera forward/backward
M.exitCinematicCamera()nilExits any global camera
M.processVehicleCameraConfigChanged(vid, vdata, focusedCamNamePrevious)nilTODO trigger this also for global cameras?
M.clearInputs()nilclearInputs
M.setRefNodes(vid, ...)proxy_camId(vid, 'setRefNodes', ...)setRefNodes
M.setRef(vid, ...)proxy_camId(vid, 'setRef', ...)setRef
M.setTargetMode(vid, ...)proxy_camId(vid, 'setTargetMode', ...)setTargetMode
M.setSkipFovModifier(vid, ...)proxy_camId(vid, 'setSkipFovModifier', .setSkipFovModifier
M.setFastSpeedModifier(enabled)nilsetFastSpeedModifier
M.setSmoothedCam(pid, ...)proxy_PID(pid, 'setSmoothedCam', ...)setSmoothedCam
M.setNewtonRotation(pid, ...)proxy_PID(pid, 'setNewtonRotation', ...)setNewtonRotation
M.setNewtonTranslation(pid, ...)proxy_PID(pid, 'setNewtonTranslation', .setNewtonTranslation
M.toggleEnabledById(camId)niltoggleEnabledById
M.changeOrder(camId, offset)nilchangeOrder
M.getActiveCamNameByVehId(vehId)nilgetActiveCamNameByVehId
M.displayCameraNameUI(player)nilsend data to Messages UI app
M.getGlobalCameras()globalCamerasCachegetGlobalCameras
M.proxy_Player(fct, ...)proxy_PID(player, fct, ...)proxy_Player
M.globalCameraFunction(globalCameraName, functionName, ...)nilglobalCameraFunction
M.requestConfig(forcedCamName)nilrequest/send data to Options > Cameras menu
M.notifyUI(vdata, forcedCamName)nilsend data to UI apps and other things
M.resetConfiguration()nilresetConfiguration
M.hotkey(player, hotkeyid, modifier)proxy_PID(player, 'hotkey', hotkeyid, mohotkey
M.rotate_pitch_down(val, filter)nilrotate_pitch_down
M.rotate_yaw_right(val, filter)nilrotate_yaw_right
M.rotate_roll_right(val, filter)nilrotate_roll_right
M.yAxisMoveStep(val)nilMove at "val" speed for some set small amount of time
M.moveleft(val)nilmoveleft
M.moveright(val)nilmoveright
M.moveforward(val)nilmoveforward
M.movebackward(val)nilmovebackward
M.moveup(val)nilmoveup
M.movedown(val)nilmovedown
M.moveForwardBackward(val)nilmoveForwardBackward
M.moveLeftRight(val)nilmoveLeftRight
M.getLastFilter()nilgetLastFilter

Public API - Camera State

FunctionSignatureReturnsDescription
M.getPosition()vec3Current camera world position
M.getPositionXYZ()x, y, zCamera position as three numbers
M.getForward()vec3Camera forward direction
M.getForwardXYZ()x, y, zForward direction as three numbers
M.getUp()vec3Camera up direction
M.getRight()vec3Camera right direction
M.getQuat()quatCamera rotation quaternion
M.getQuatXYZW()x, y, z, wRotation as four numbers
M.getFovDeg()numberField of view in degrees
M.getFovRad()numberField of view in radians
M.getActiveCamName(player)stringActive camera name for player
M.getActiveGlobalCameraName()string/nilActive global camera name
M.getDriverData(veh)nodeId, rhd, rhdDoorDriver camera node info
M.getDriverDataById(vehId)nodeId, rhd, rhdDoorDriver camera node by vehicle ID
M.getCameraDataById(vid)tableAll cameras for a vehicle
M.isCameraInside(player, camPos)0/1Whether camera is inside vehicle OBB
M.objectTeleported(cur, prev, prevVel, dt)booleanDetects if object teleported between frames
M.getSpeed()numberFree camera movement speed
M.timeSinceLastRotation()numberMilliseconds since last camera rotation input

Public API - Camera Control

FunctionSignatureReturnsDescription
M.setPosition(pid, pos)nilSets camera position (free cam)
M.setRotation(vid, rot)nilSets camera rotation
M.setFOV(vid, fov)nilSets field of view
M.setOffset(vid, offset)nilSets camera offset
M.setDistance(vid, dist)nilSets orbit distance
M.setDefaultDistance(vid, dist)nilSets default orbit distance
M.setMaxDistance(vid, dist)nilSets maximum orbit distance
M.setDefaultRotation(vid, rot)nilSets default rotation
M.setPosRot(pid, px,py,pz, rx,ry,rz,rw)nilSets position and rotation (free cam only)
M.setSpeed(speed)nilSets free camera speed
M.setLookBack(player, enabled)nilEnables look-back mode
M.resetCamera(player)nilResets camera to default state
M.resetCameraByID(vid)nilResets camera for a specific vehicle
M.changeSpeed(val)nilAdjusts free camera speed by multiplier

Public API - Input Bindings

FunctionDescription
M.rotate_yawYaw rotation (combined axis)
M.rotate_yaw_leftYaw rotation left
M.rotate_yaw_rightYaw rotation right
M.rotate_pitchPitch rotation (combined axis)
M.rotate_pitch_upPitch rotation up
M.rotate_pitch_downPitch rotation down
M.rotate_yaw_relativeMouse yaw (relative input)
M.rotate_pitch_relativeMouse pitch (relative input)
M.rotate_roll_leftRoll rotation left
M.rotate_roll_rightRoll rotation right
M.cameraZoomZoom in/out
M.moveleftMove camera left
M.moverightMove camera right
M.moveforwardMove camera forward
M.movebackwardMove camera backward
M.moveupMove camera up
M.movedownMove camera down
M.moveForwardBackwardCombined forward/backward axis
M.moveLeftRightCombined left/right axis
M.yawAbs3D spacemouse yaw rotation
M.rollAbs3D spacemouse roll rotation
M.pitchAbs3D spacemouse pitch rotation
M.xAxisAbs3D spacemouse X-axis translation
M.yAxisAbs3D spacemouse Y-axis translation
M.zAxisAbs3D spacemouse Z-axis translation
M.yAxisMoveStepMove at given speed for a small fixed duration

Camera Mode Discovery

Camera modes are auto-discovered from /lua/ge/extensions/core/cameraModes/*.lua. Each file returns a constructor function. Cameras can be:

  • Vehicle cameras: Per-vehicle, configured via jBeam cameraData
  • Global cameras: Singleton, always exist (e.g. bigMap, free, transition)
  • Filter cameras: Modify other cameras' output (e.g. collision, autozoom)

Configuration Persistence

Camera order and enabled state are saved to settings.cameraConfig as JSON. The system attempts camera selection in priority order:

  1. Saved request (requestedCam)
  2. Previous camera name
  3. First enabled camera
  4. First visible camera
  5. Fallback to orbit

Hooks

HookPurpose
M.onReplayStateChangedCalled on ReplayStateChanged event
M.onTriggerCalled on Trigger event
M.onSettingsChangedCalled on SettingsChanged event
M.onVehicleResettedCalled on VehicleResetted event
M.onVehicleSpawnedCalled on VehicleSpawned event
M.onVehicleSwitchedCalled on VehicleSwitched event
M.onDespawnObjectCalled on DespawnObject event
M.onVehicleDestroyedCalled on VehicleDestroyed event
M.onScenarioRestartedCalled on ScenarioRestarted event
M.onScenarioChangeCalled on ScenarioChange event
M.onFileChangedCalled on FileChanged event
M.onMouseLockedCalled on MouseLocked event
M.onClientPostStartMissionCalled on ClientPostStartMission event
M.onClientEndMissionCalled on ClientEndMission event
M.onSerializeCalled on Serialize event
M.onDeserializedCalled on Deserialized event

Module State

VariableTypeDefault
M.dependenciestable{'core_vehicle_manager', 'core_environment'}
M.speedFactornumber1 - used to fix too smooth/slow camera movement when creating thumbnails
M.onPreRenderfunctionMain camera update function, called right before rendering
M.previousReplayStateNamevariesTracks previous replay state

Usage Examples

-- Switch to chase camera for player 0
core_camera.setByName(0, "chase")

-- Set global free camera
core_camera.setGlobalCameraByName("free")

-- Get camera position for distance calculations
local pos = core_camera.getPosition()

-- Check active camera
local camName = core_camera.getActiveCamName(0) -- "orbit", "driver", etc.

Bus Route Manager

Manages bus route definitions and bus stop trigger events. Loads route data from JSON files, validates stop triggers against the scene, and dispatches events to bus vehicle controllers.

Core Chat (IRC)

IRC-based in-game chat system connecting to `irc.beamng.com`. **Currently disabled** - the entire module is wrapped in a block comment.

On this page

Public API - Camera SelectionPublic API - Camera StatePublic API - Camera ControlPublic API - Input BindingsCamera Mode DiscoveryConfiguration PersistenceHooksModule StateUsage Examples