Camera Mode: Orbit
The primary third-person vehicle camera. Orbits around the vehicle with mouse/gamepad rotation, dynamic FOV (dolly zoom), dynamic pitch, collision avoidance, and smooth relaxation-based auto-tracking.
The primary third-person vehicle camera. Orbits around the vehicle with mouse/gamepad rotation, dynamic FOV (dolly zoom), dynamic pitch, collision avoidance, and smooth relaxation-based auto-tracking.
Overview
The orbit camera is the default external view. It maintains a configurable distance from the vehicle, smoothly follows the vehicle's heading via a relaxation system, and allows manual rotation. Features include speed-dependent FOV widening (dolly zoom), dynamic pitch offset at speed, height offset, and collision detection to avoid clipping through geometry.
Class Properties
| Property | Type | Default | Description |
|---|---|---|---|
camRot | vec3 | defaultRotation | Current yaw/pitch rotation |
camDist | number | distance or 5 | Current orbit distance |
camMinDist | number | distanceMin or 3 | Minimum zoom distance |
camMaxDist | number | distanceMin*10 | Maximum zoom distance |
defaultRotation | vec3 | (0, -17, 0) | Default yaw/pitch/roll |
defaultDistance | number | distance or 5 | Default orbit distance |
fov | number | 65 | Base field of view |
mode | string | 'ref' | Target mode (ref or custom) |
lockCamera | bool | false | Lock rotation to manual input |
relaxation | number | from settings | Auto-follow smoothing distance |
offset | vec3 | vec3() | Target position offset |
Methods
| Method | Signature | Description |
|---|---|---|
init | C:init() | Full initialization with collision, settings |
onVehicleCameraConfigChanged | C:onVehicleCameraConfigChanged() | Reload jbeam camera config |
onSettingsChanged | C:onSettingsChanged() | Reload user settings |
reset | C:reset() | Reset rotation/distance to defaults |
update | C:update(data) | Main update - position, rotation, FOV, collision |
setRotation | C:setRotation(rot) | Set rotation programmatically |
setFOV | C:setFOV(fov) | Set base FOV |
setOffset | C:setOffset(v) | Set orbit center offset |
setRefNodes | C:setRefNodes(centerNodeID, leftNodeID, backNodeID, dynamicFovRearNodeID) | Set reference nodes |
setRef | C:setRef(center, left, back) | Set global-coord targets |
setTargetMode | C:setTargetMode(targetMode, camBase) | Switch target computation |
setDefaultDistance | C:setDefaultDistance(d) | Set default distance |
setDistance | C:setDistance(d) | Set current distance |
setMaxDistance | C:setMaxDistance(d) | Set max zoom distance |
setDefaultRotation | C:setDefaultRotation(rot) | Set default rotation |
setSkipFovModifier | C:setSkipFovModifier(skip) | Disable dynamic FOV |
calculateDynamicPitchLimit | C:calculateDynamicPitchLimit(data, targetPos) | Compute max pitch offset |
onVehicleSwitched | C:onVehicleSwitched() | Reset collision on switch |
Settings (from user preferences)
| Setting Key | Property | Description |
|---|---|---|
cameraOrbitFovModifier | fovModifier | Static FOV offset |
cameraOrbitRelaxation | relaxation | Auto-follow smoothness (default 3) |
cameraOrbitMaxDynamicFov | maxDynamicFov | Max speed-based FOV increase (default 35) |
cameraOrbitMaxDrivingPitch | maxDynamicPitch | Max pitch offset at speed (radians) |
cameraOrbitMaxDynamicOffset | maxDynamicOffset | Max height offset at speed |
cameraOrbitSmoothing | smoothingEnabled | Enable rotation smoothing |
Dynamic FOV (Dolly Zoom)
-- FOV increases with speed, distance adjusted to preserve vehicle screen size
fov = self.fov + fovModifier + self.maxDynamicFov * math.min(1, vel:length() / 130)
fovdistDiff = (self.camDist - refToRear) *
(math.tan((self.fov + fovModifier) * hdegToRad) / math.tan(fov * hdegToRad) - 1)Relaxation Auto-Follow
-- Camera lazily follows vehicle heading via relaxation point
self.camLastPos2 = lastCamPointVec * (self.relaxation / lastCamPointVec:length()) + targetPosKey Notes
- Uses
collisionsub-module for camera-terrain/geometry intersection - Rotation smoothing uses exponential ratio blending at 8x dt
- Pitch clamped to ±85°, yaw wraps at ±180°
data.res.collisionCompatible = trueenables collision post-processing- Dynamic pitch activates above 10 m/s, deactivates below 1 m/s with delay
- Look-back mode overrides rotation and uses a fixed rear direction
See Also
- Camera Mode: Autopoint - Related reference
- Camera Mode: Autozoom - Related reference
- Camera Mode: Big Map - Related reference
- Core Systems Guide - Guide
Camera Mode: Onboard
Vehicle-mounted camera that follows a specific node position with configurable rotation and offset. Used for cockpit, hood, bumper, and other vehicle-attached views.
Camera Mode: Pacenote Orbit
Global orbit camera for the pacenote/rally editor. Orbits a fixed world-space target point with mouse/keyboard rotation, zoom, and terrain collision avoidance.