-
Notifications
You must be signed in to change notification settings - Fork 4
/
ac_cockpit_camera.lua
53 lines (41 loc) · 1.52 KB
/
ac_cockpit_camera.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
__source 'extensions/neck/ac_ext_neck.cpp'
require './common/internal_import'
require './common/ac_audio'
require './wfx_common/ac_weatherconditions'
ac.CockpitCameraMode = __enum({}, {
Base = 0, -- Regular mode (or a mode with connected TrackIR which hasn’t moved yet)
IR = 1, -- TrackIR mode (input `neck` position and orientation is already offset)
VR = 2, -- VR mode (better to do the absolute minimum there, only some sort of G-forces reaction)
})
-- automatically generated entries go here:
__definitions()
-- extra additions:
---Reference to information about state of associated car.
---@type ac.StateCar
car = nil
---Reference to information about state of simulation.
---@type ac.StateSim
sim = nil
---Reference to camera transformation. Alter its `look`, `up` and `position` to move the camera.
---@type mat4x4
neck = nil
function __script.updateState(carIndex)
if not car or car.index ~= carIndex then
car = ac.getCar(carIndex)
if not sim then
sim = ac.getSim()
neck = ffi.C.lj_access_neck_data()
end
end
end
-- script format:
---@class ScriptData
---@single-instance
script = {}
--[[? if (ctx.ldoc) out(]]
---Called each frame.
---@param dt number @Time passed since last `update()` call, in seconds.
---@param mode ac.CockpitCameraMode @Current mode. Mostly for checking if VR is active and stopping extra rotation if so.
---@param turnMix number @How much to turn head willingly (goes to 0 with TrackIR or mouse camera rotation)
function script.update(dt, mode, turnMix) end
--[[) ?]]