Camera Mode: Handheld
Spring-damper filter that adds handheld camera feel by smoothing the look direction with physical simulation. Creates a natural lag and sway effect on the camera's aim direction.
Spring-damper filter that adds handheld camera feel by smoothing the look direction with physical simulation. Creates a natural lag and sway effect on the camera's aim direction.
Overview
A hidden filter camera mode that applies spring-damper physics to the camera's look direction. Instead of the camera instantly tracking the target, it uses a velocity-based spring system to create organic, operator-like camera movement.
Class Properties
| Property | Type | Default | Description |
|---|---|---|---|
isFilter | bool | true | Post-processes other camera output |
hidden | bool | true | Not selectable by the user |
k | number | 20 | Spring stiffness for direction tracking |
damping | number | 5 | Velocity damping factor |
rotk | number | 3 | Rotational spring for roll correction |
vel | vec3 | vec3() | Current angular velocity |
mustReset | bool | true | Reset direction on next update |
Methods
| Method | Signature | Description |
|---|---|---|
init | C:init(spring, damping, rotspring) | Configures spring/damper constants |
update | C:update(data) | Applies spring-damper to look direction |
Spring-Damper Physics
-- Direction tracking with spring-damper
local curDir = (data.res.targetPos - data.res.pos):normalized()
local force = curDir - self.dir
force = self.k * force - self.damping * self.vel
self.vel = self.vel + force * data.dt
self.dir = (self.dir + self.vel * data.dt):normalized()Roll Correction
-- Roll correction uses force projected onto the look plane
local up = (-self.rotk * data.dt * force:projectToOriginPlane(self.dir) + vec3(0,0,1)):normalized()
-- OpenXR forces world-up to avoid VR sickness
if data.openxrSessionRunning then up = vec3(0,0,1) end
data.res.rot = quatFromDir(self.dir, up)Key Notes
- Resets
self.diron first frame after enable (mustReset) - Higher
k= stiffer tracking, higherdamping= less oscillation - Roll effect is subtle - driven by lateral force component
- VR mode disables roll to prevent motion sickness
See Also
- Camera Mode: Autopoint - Related reference
- Camera Mode: Autozoom - Related reference
- Camera Mode: Big Map - Related reference
- Core Systems Guide - Guide
Camera Mode: Game Engine
Final-stage camera filter that commits the computed camera state to the engine. Handles OpenXR/VR pose integration before pushing position, rotation, FOV, and near clip to the renderer.
Camera Mode: Manual Zoom
Filter camera mode providing manual FOV zoom control via player input (zoom in/out bindings). Displays a UI notification when FOV changes.