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
Camera Mode: AutopointCamera Mode: AutozoomCamera Mode: Big MapCamera Mode: ChaseCamera Mode: CollisionCamera Mode: CrashCamera Mode: DriverCamera Mode: External / Fan CameraCamera Mode: FallbackCamera Mode: Free CameraCamera Mode: Game EngineCamera Mode: HandheldCamera Mode: Manual ZoomCamera Mode: NoiseCamera Mode: ObserverCamera Mode: OnboardCamera Mode: OrbitCamera Mode: Pacenote OrbitCamera Mode: PathCamera Mode: PredictorCamera Mode: RelativeCamera Mode: ShakeCamera Mode: SmoothCamera Mode: Top DownCamera Mode: TrackIRCamera Mode: TransitionCamera Mode: Unicycle

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 ExtensionscorecameraModes

Camera Mode: Unicycle

First-person walking camera for the unicycle vehicle. Handles ground detection, collision, gravity, VR snap-turning, and communicates rotation data back to the vehicle controller.

First-person walking camera for the unicycle vehicle. Handles ground detection, collision, gravity, VR snap-turning, and communicates rotation data back to the vehicle controller.


Overview

The unicycle camera provides a first-person walking experience. It performs raycasting to walk on terrain, applies simple gravity for falls, handles wall collisions at hip height, and supports OpenXR VR snap-turning. The camera rotation is sent back to the vehicle's playerController to steer the unicycle.


Class Properties

PropertyTypeDefaultDescription
hiddenbooltrueNot in standard camera cycle
posvec3computedCurrent eye position
rotVecvec3computedCurrent Euler rotation (yaw, pitch, roll)
manualzoommanualzoom-FOV zoom component (currently disabled)

Methods

MethodSignatureDescription
initC:init()Set up manualzoom and settings
onSettingsChangedC:onSettingsChanged()Reload VR snap turn settings
onCameraChangedC:onCameraChanged(focused)Load/restore unicycle UI layout
resetC:reset()Reset zoom
setCustomDataC:setCustomData(data)Set initial pos/rotation from {pos, front, up}
getPosRotC:getPosRot()Return current position and rotation quaternion
updateC:update(data)Process input, walk, apply camera

Walking Physics

-- Constants
local humanHeight = 1.6
local maxFallHeight = 10
local gravity = -2
local teleportingSpeed = 1000 / 3.6  -- 277 m/s threshold

-- Ground detection: raycast from hip down
local hip = oldGround + vec3(0, 0, getHipHeight())
local newGround = castRayLocation(hip, oldGround + vec3(0, 0, -maxFallHeight))

-- Gravity: fall toward ground or into abyss
if newGround.z < oldGround.z then
  newGround.z = max(oldGround.z + gravity * dt, newGround.z)
end

-- Wall collision: raycast at hip height
local hipCollisionPoint = castRayLocation(prevKnee, newKnee)
if hipCollisionPoint then
  -- Stay 0.3m away from wall
  newKnee = hipCollisionPoint + diff:normalized() * 0.3
end

VR Snap Turning

-- OpenXR snap turn: discrete rotation steps
if self.openXRsnapTurnUnicycle then
  if mustTurn then
    self.rotVec.x = self.rotVec.x + sign(rdx) * self.openXRsnapTurnUnicycleDegrees
  end
  -- Re-trigger every 0.4 seconds when held
end

-- VR "look down" triggers 180° turn
if rdyNotMouse < -0.15 then
  self.rotVec.x = self.rotVec.x + 180
end

Vehicle Communication

-- Send camera rotation to unicycle vehicle controller
data.veh:queueLuaCommand(
  "controller.getControllerSafe('playerController').setCameraControlData("
  .. serialize({cameraRotation = rotHorizontal}) .. ")"
)

Settings

Setting KeyDescription
openXRsnapTurnUnicycleEnable VR snap turning
openXRsnapTurnUnicycleDegreesDegrees per snap turn

Key Notes

  • Uses data.dtSim for physics timing
  • Pitch clamped to ±89.9° (with float precision safety margin)
  • Teleport detection: if position delta exceeds 277 m/s, reset prevCamPos
  • Eye position = ground + humanHeight (1.6m), crouching = 70%
  • Hip height = 45% of human height, used for collision checks
  • Sends horizontal-only rotation to vehicle (pitch stripped for movement)

See Also

  • Camera Mode: Autopoint - Related reference
  • Camera Mode: Autozoom - Related reference
  • Camera Mode: Big Map - Related reference
  • Core Systems Guide - Guide

Camera Mode: Transition

Global filter that smoothly interpolates between camera states during camera mode switches and vehicle changes. Prevents jarring cuts by blending position, rotation, and FOV over a configurable durati

Input Action Filter

Blocks or allows specific input actions by name or group. Used to restrict player actions during missions, scenarios, and specific game states (e.g. disabling vehicle switching during a race).

On this page

OverviewClass PropertiesMethodsWalking PhysicsVR Snap TurningVehicle CommunicationSettingsKey NotesSee Also