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.
Global filter that integrates TrackIR head-tracking hardware. Translates and rotates the camera based on the player's physical head position and orientation.
Overview
A hidden global filter with runningOrder = 0.5 (runs before the game engine filter). Initializes the TrackIR SDK, reads 6DOF head tracking data, and applies translation + rotation offsets to the camera. Disabled during OpenXR/VR sessions to avoid conflicts.
Class Properties
| Property | Type | Default | Description |
|---|---|---|---|
isGlobal | bool | true | Always active when TrackIR is available |
runningOrder | number | 0.5 | Runs before game engine filter |
isFilter | bool | true | Post-processes other camera output |
hidden | bool | true | Not selectable by the user |
working | bool | false | Whether TrackIR initialized successfully |
Sensitivity Constants
| Constant | Value | Description |
|---|---|---|
move_sensitivity | 0.00005 | Translation scale factor |
rotate_sensitivity | 0.01 | Rotation scale factor |
Methods
| Method | Signature | Description |
|---|---|---|
init | C:init() | Initialize TrackIR SDK, start recording |
update | C:update(data) | Read TrackIR data, apply to camera |
TrackIR Data Application
-- Translation: remap TrackIR axes to BeamNG space
local trans = vec3(-t.nx, -t.nz, t.ny) * move_sensitivity
trans = data.res.rot * trans -- rotate into camera space
data.res.pos = data.res.pos + trans
-- Rotation: apply yaw/pitch/roll
local q = rotateEuler(
math.rad(t.yaw * rotate_sensitivity),
math.rad(t.pitch * rotate_sensitivity) + math.pi,
math.rad(t.roll * -rotate_sensitivity)
)
data.res.rot = q * data.res.rotTrackIR Data Fields
| Field | Description |
|---|---|
t.nx | X translation |
t.ny | Y translation |
t.nz | Z translation |
t.yaw | Head yaw angle |
t.pitch | Head pitch angle |
t.roll | Head roll angle |
Key Notes
- Uses global
TrackIRobject - nil if hardware not present - Calls
TrackIR.init()andTrackIR.start()on first load - If already recording (e.g., module reload), skips init
- Disabled during OpenXR sessions to avoid tracking conflicts
- Axis remapping: TrackIR Y→BeamNG Z, TrackIR Z→BeamNG -Y
See Also
- Camera Mode: Autopoint - Related reference
- Camera Mode: Autozoom - Related reference
- Camera Mode: Big Map - Related reference
- Core Systems Guide - Guide
Camera Mode: Top Down
Example custom camera mode providing a top-down overhead view of the vehicle. Height and look-ahead scale with vehicle speed.
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