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
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 duration.
Overview
A hidden global filter with runningOrder = 0.2 (runs early in the pipeline). When a camera switch or vehicle change occurs, it captures the old camera state and blends toward the new state over a configurable transition duration. Uses quadratic easing for smooth deceleration. Performs line-of-sight checks to skip transitions when the path is obstructed.
Class Properties
| Property | Type | Default | Description |
|---|---|---|---|
isGlobal | bool | true | Always active |
runningOrder | number | 0.2 | Runs early in filter chain |
isFilter | bool | true | Post-processes other camera output |
hidden | bool | true | Not selectable by the user |
transitionTime | number | 0 | Remaining blend time |
transitionDuration | number | from settings | Mode-switch blend duration (sec) |
transitionVehicleDuration | number | from settings | Vehicle-switch blend duration (sec) |
camLastPosRel | vec3 | - | Previous relative position |
camLastPosAbs | vec3 | - | Previous absolute position |
camLastFOV | number | 90 | Previous FOV |
camLastQDir | quat | - | Previous rotation |
camLastNearClip | number | 0.1 | Previous near clip |
Methods
| Method | Signature | Description |
|---|---|---|
init | C:init() | Initialize state and load settings |
onSettingsChanged | C:onSettingsChanged() | Reload transition durations |
canTransition | C:canTransition(origin, target) | Check line-of-sight (max 100m) |
update | C:update(data) | Blend between old and new camera state |
start | C:start(isVehicleSwitch, camPathTransitionData) | Request a new transition |
Settings
| Setting Key | Default | Description |
|---|---|---|
cameraTransitionTime | 300 | Mode-switch transition (ms) |
cameraVehicleTransitionTime | 500 | Vehicle-switch transition (ms) |
Transition Blending
-- Quadratic ease-out blending
self.transitionTime = math.max(0, self.transitionTime - data.dt)
local perc = (self.transitionTime / oldTransitionTime)
perc = perc * perc -- quadratic easing
-- Blend all camera properties
data.res.pos = data.res.pos + (self.camLastPosRel - data.res.pos) * perc
data.res.fov = data.res.fov + (self.camLastFOV - data.res.fov) * perc
data.res.rot = data.res.rot:nlerp(self.camLastQDir, perc)Line-of-Sight Check
-- Skip transition if camera would clip through geometry
function C:canTransition(origin, target)
local dir = target - origin
local dist = dir:length()
if dist > 100 then return false end
return castRayStatic(origin, dir, dist) >= dist
and castRayStatic(target, -dir, dist) >= dist
endKey Notes
- Works in vehicle-relative space during blending, then converts back to absolute
camPathTransitionDataallows camera path system to inject old state via callback- First frame after init (
firstTime = false) skips transition to avoid glitch - Vehicle switches use longer duration than mode switches
See Also
- Camera Mode: Autopoint - Related reference
- Camera Mode: Autozoom - Related reference
- Camera Mode: Big Map - Related reference
- Core Systems Guide - Guide
Camera Mode: TrackIR
Global filter that integrates TrackIR head-tracking hardware. Translates and rotates the camera based on the player's physical head position and orientation.
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.