Camera Mode: Relative
Vehicle-relative free camera with full 6DOF movement, saveable position slots, adjustable point light, and near-clip control. The primary camera for cinematic vehicle photography.
Vehicle-relative free camera with full 6DOF movement, saveable position slots, adjustable point light, and near-clip control. The primary camera for cinematic vehicle photography.
Overview
The relative camera moves freely in vehicle-local space - it stays attached to the vehicle's reference frame but can be positioned and rotated independently. Features include 10 saveable camera slots (with optional names from jbeam), a toggleable point light for dark environments, adjustable near-clip distance, and smooth input processing.
Class Properties
| Property | Type | Default | Description |
|---|---|---|---|
disabledByDefault | bool | true | Must be enabled in settings |
resetCameraOnVehicleReset | bool | false | Keep position on vehicle reset |
lightBrightness | number | 0 | Point light brightness (0 = off) |
camMaxDist | number | math.huge | Max distance from ref node |
slots | table | {} | Saved position/rotation/FOV presets |
slotNameIndexMap | table | {} | Name-to-index lookup for slots |
pos | vec3 | computed | Position in vehicle-local space |
rot | vec3 | (0, 180, 0) | Euler rotation (yaw, pitch, roll) |
nearClip | number | nil | Custom near clip (nil = level default) |
Methods
| Method | Signature | Description |
|---|---|---|
init | C:init() | Initialize camera, zoom, slots |
onVehicleCameraConfigChanged | C:onVehicleCameraConfigChanged() | Handle vehicle/config change |
reset | C:reset() | Reset to saved position |
update | C:update(data) | Process movement/rotation input |
saveSlot | C:saveSlot(slot) | Store pos/rot/fov to slot number |
loadSlot | C:loadSlot(slot) | Load from slot (number or name) |
setFOV | C:setFOV(fov) | Set zoom FOV |
setRotation | C:setRotation(rot) | Set rotation vector |
setOffset | C:setOffset(pos) | Set position offset |
setMaxDistance | C:setMaxDistance(d) | Set max distance from vehicle |
hotkey | C:hotkey(hotkey, modifier) | Handle slot hotkeys (0=load, 1=save) |
setRefNodes | C:setRefNodes(center, left, back) | Set reference nodes |
onCameraChanged | C:onCameraChanged(focused) | Setup/teardown quick access menus |
sendMenus | C:sendMenus() | Register quick-access radial entries |
C:_updateLight | (brightness) | Creates/updates/removes point light at given brightness |
C:storeLightInfo | () | Save light state when switching away |
C:restoreLightInfo | () | Restore light state when switching back |
Quick Access Radial Menu
Registers entries under /root/sandbox/camera/:
- Light - Cycle brightness: 0% → 10% → 50% → 100% → 0%
- Near Clip - Cycle: level default → 0.0005m → 0.01m → 0.1m → default
- Slots - Sub-menu with 10 numbered slots (save/load)
Movement System
-- Smoothed 6DOF input
local dx = dxSmoother:getCapped(MoveManager.right - MoveManager.left, dt)
local dy = dySmoother:getCapped(MoveManager.forward - MoveManager.backward, dt)
local dz = dzSmoother:getCapped(MoveManager.up - MoveManager.down, dt)
-- Position in vehicle-local space, rotated by look direction
self.pos = self.pos + qdirLook * pdPoint Light
-- Creates a PointLight scene object named 'relativecameralight'
local l = createObject('PointLight')
l.canSave = false
l.radius = 20
l:registerObject('relativecameralight')Key Notes
- Position is stored in vehicle-local coordinates (survives vehicle movement)
- Default position computed from
getSpawnWorldOOBBRearPoint()if no slots defined - jbeam can define named camera presets that auto-populate slots
- Speed modifier (
data.fastSpeedModifier) triples movement speed - Near clip control is critical for close-up shots without z-fighting
- Light position follows camera for interior/engine bay photography
See Also
- Camera Mode: Autopoint - Related reference
- Camera Mode: Autozoom - Related reference
- Camera Mode: Big Map - Related reference
- Core Systems Guide - Guide
Camera Mode: Predictor
Filter that shifts the camera's look-at target ahead of the vehicle based on velocity. Creates a forward-looking effect that anticipates the vehicle's movement.
Camera Mode: Shake
Sinusoidal camera shake filter that adds continuous oscillating position and rotation offsets. Creates a smooth, rhythmic shake effect for cinematic or impact scenarios.