diff --git a/Nasal/Sim/libraries.nas b/Nasal/Sim/libraries.nas index 6995097d..416b44db 100644 --- a/Nasal/Sim/libraries.nas +++ b/Nasal/Sim/libraries.nas @@ -731,9 +731,125 @@ var resetView = func() { } interpolate("sim/current-view/field-of-view", 63, 0.66); - interpolate("sim/current-view/heading-offset-deg", hd_t,0.66); - interpolate("sim/current-view/pitch-offset-deg", -14.6,0.66); + interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66); + interpolate("sim/current-view/pitch-offset-deg", -14.6, 0.66); + interpolate("sim/current-view/roll-offset-deg", 0, 0.66); + interpolate("sim/current-view/x-offset-m", -0.45, 0.66); + interpolate("sim/current-view/y-offset-m", 2.34, 0.66); + interpolate("sim/current-view/z-offset-m", -13.75, 0.66); + + if (_shakeFlag) { + setprop("sim/rendering/headshake/enabled", 1); + } + } +} + +var autopilotView = func() { + if (getprop("sim/current-view/view-number") == 0) { + if (getprop("sim/rendering/headshake/enabled")) { + var _shakeFlag = 1; + setprop("sim/rendering/headshake/enabled", 0); + } else { + var _shakeFlag = 0; + } + + var hd = getprop("sim/current-view/heading-offset-deg"); + var hd_t = 341.7; + if (hd < 180) { + hd_t = hd_t - 360; + } + + interpolate("sim/current-view/field-of-view", 63, 0.66); + interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66); + interpolate("sim/current-view/pitch-offset-deg", -16.4, 0.66); + interpolate("sim/current-view/roll-offset-deg", 0, 0.66); + interpolate("sim/current-view/x-offset-m", -0.45, 0.66); + interpolate("sim/current-view/y-offset-m", 2.34, 0.66); + interpolate("sim/current-view/z-offset-m", -13.75, 0.66); + + if (_shakeFlag) { + setprop("sim/rendering/headshake/enabled", 1); + } + } +} + +var overheadView = func() { + if (getprop("sim/current-view/view-number") == 0) { + if (getprop("sim/rendering/headshake/enabled")) { + var _shakeFlag = 1; + setprop("sim/rendering/headshake/enabled", 0); + } else { + var _shakeFlag = 0; + } + + var hd = getprop("sim/current-view/heading-offset-deg"); + var hd_t = 348; + if (hd < 180) { + hd_t = hd_t - 360; + } + + interpolate("sim/current-view/field-of-view", 105.8, 0.66); + interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66); + interpolate("sim/current-view/pitch-offset-deg", 65.25, 0.66); interpolate("sim/current-view/roll-offset-deg", 0,0.66); + interpolate("sim/current-view/x-offset-m", -0.12, 0.66); + interpolate("sim/current-view/y-offset-m", 2.34, 0.66); + interpolate("sim/current-view/z-offset-m", -13.75, 0.66); + + if (_shakeFlag) { + setprop("sim/rendering/headshake/enabled", 1); + } + } +} + +var pedestalView = func() { + if (getprop("sim/current-view/view-number") == 0) { + if (getprop("sim/rendering/headshake/enabled")) { + var _shakeFlag = 1; + setprop("sim/rendering/headshake/enabled", 0); + } else { + var _shakeFlag = 0; + } + + var hd = getprop("sim/current-view/heading-offset-deg"); + var hd_t = 315; + if (hd < 180) { + hd_t = hd_t - 360; + } + + interpolate("sim/current-view/field-of-view", 63, 0.66); + interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66); + interpolate("sim/current-view/pitch-offset-deg", -46.3, 0.66); + interpolate("sim/current-view/roll-offset-deg", 0, 0.66); + interpolate("sim/current-view/x-offset-m", -0.45, 0.66); + interpolate("sim/current-view/y-offset-m", 2.34, 0.66); + interpolate("sim/current-view/z-offset-m", -13.75, 0.66); + + if (_shakeFlag) { + setprop("sim/rendering/headshake/enabled", 1); + } + } +} + +var lightsView = func() { + if (getprop("sim/current-view/view-number") == 0) { + if (getprop("sim/rendering/headshake/enabled")) { + var _shakeFlag = 1; + setprop("sim/rendering/headshake/enabled", 0); + } else { + var _shakeFlag = 0; + } + + var hd = getprop("sim/current-view/heading-offset-deg"); + var hd_t = 335; + if (hd < 180) { + hd_t = hd_t - 360; + } + + interpolate("sim/current-view/field-of-view", 63, 0.66); + interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66); + interpolate("sim/current-view/pitch-offset-deg", 10.6, 0.66); + interpolate("sim/current-view/roll-offset-deg", 0, 0.66); interpolate("sim/current-view/x-offset-m", -0.45, 0.66); interpolate("sim/current-view/y-offset-m", 2.34, 0.66); interpolate("sim/current-view/z-offset-m", -13.75, 0.66);