-
Notifications
You must be signed in to change notification settings - Fork 2
/
HeadtrackingCameraSuspension.lua
26 lines (21 loc) · 1.07 KB
/
HeadtrackingCameraSuspension.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
HeadtrackingCameraSuspension = {}
---Called when camera suspension setting has changed
-- @param bool newState new setting state
function HeadtrackingCameraSuspension:onActiveCameraSuspensionSettingChanged(superFunc, newState)
-- print("VehicleCamera:onActiveCameraSuspensionSettingChanged")
if self.suspensionNode ~= nil then
if self.lastActiveCameraSuspensionSetting ~= newState then
if newState then
link(self.cameraSuspensionParentNode, self.cameraPositionNode)
else
link(self.cameraBaseParentNode, self.cameraPositionNode)
end
-- Update headTrackingNode
if self.headTrackingNode ~= nil then
link(getParent(self.cameraPositionNode), self.headTrackingNode)
end
self.lastActiveCameraSuspensionSetting = newState
end
end
end
VehicleCamera.onActiveCameraSuspensionSettingChanged = Utils.overwrittenFunction(VehicleCamera.onActiveCameraSuspensionSettingChanged, HeadtrackingCameraSuspension.onActiveCameraSuspensionSettingChanged)