-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathac_chaser_camera.lua
56 lines (43 loc) · 1.36 KB
/
ac_chaser_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
54
55
56
__source 'extensions/chaser_camera/ac_ext_chaser_camera.cpp'
--[[? ctx.flags.withoutSceneAPI = true; ?]]
require './common/internal_import'
require './common/ac_audio'
require './common/ac_extras_binaryinput'
require './common/ac_extras_yebiscolorcorrection'
-- 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
function __script.updateState(carIndex)
if not car or car.index ~= carIndex then
car = ac.getCar(carIndex)
if not sim then
sim = ac.getSim()
end
end
end
---Gets chase camera settings.
---@return { distance: number, height: number, pitch: number }
function ac.getCameraParameters(index)
local parameters = ffi.C.lj_get_camera_params_as_vec3(index)
return { distance = parameters.x, height = parameters.y, pitch = parameters.z }
end
---@return vec2
function ac.getJoystickLook()
local parameters = ffi.C.lj_get_joystick_look()
return parameters.x ~= 0 and vec2(parameters.y, parameters.z) or nil
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.
function script.update(dt) end
--[[) ?]]