issue #281: tutorial's view direction messed-up/unusable by outside views
When user switched to a different view mode (e.g. chase/helicopter/tower view) before or during a tutorial, everything went wrong... Need to control (save/restore/switch) the view number (view mode) during tutorials. Also adds an option to explicitly change view mode during a tutorial, i.e. tutorials can switch to tower view, chase view, ... now.
This commit is contained in:
parent
957305f41b
commit
f2d2b8e8b1
3 changed files with 9 additions and 0 deletions
|
@ -341,8 +341,11 @@ view to a new view position/direction. All parameters are optional. If, for
|
||||||
example, only <field-of-view> is set, then the view will only zoom in -- the
|
example, only <field-of-view> is set, then the view will only zoom in -- the
|
||||||
direction and position will remain the same. This feature is meant for cockpit
|
direction and position will remain the same. This feature is meant for cockpit
|
||||||
tutorials, where the pilot's view is directed to some switch or instrument.
|
tutorials, where the pilot's view is directed to some switch or instrument.
|
||||||
|
view-number can be used to switch between different views, i.e. to tower-view,
|
||||||
|
copilot view etc. Default view-number is 0 (captain's view).
|
||||||
|
|
||||||
<view>
|
<view>
|
||||||
|
<view-number>0</view-number> 0=captain's view, 1=copilot,...
|
||||||
<heading-offset-deg>20</heading-offset-deg> positive is left
|
<heading-offset-deg>20</heading-offset-deg> positive is left
|
||||||
<pitch-offset-deg>-4</pitch-offset-deg> positive is up
|
<pitch-offset-deg>-4</pitch-offset-deg> positive is up
|
||||||
<roll-offset-deg>0</roll-offset-deg> positive is roll right
|
<roll-offset-deg>0</roll-offset-deg> positive is roll right
|
||||||
|
|
|
@ -345,6 +345,9 @@ var set_view = func(node = nil) {
|
||||||
node != nil or return;
|
node != nil or return;
|
||||||
var v = node.getChild("view");
|
var v = node.getChild("view");
|
||||||
if (v != nil) {
|
if (v != nil) {
|
||||||
|
# when changing view direction, switch to view 0 (captain's view),
|
||||||
|
# unless another view is explicitly specified
|
||||||
|
v.initNode("view-number", 0, "INT", 0);
|
||||||
view.point.move(v);
|
view.point.move(v);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,6 +593,9 @@ var point = {
|
||||||
},
|
},
|
||||||
move : func(prop, time = nil) {
|
move : func(prop, time = nil) {
|
||||||
prop != nil or return;
|
prop != nil or return;
|
||||||
|
var n = prop.getNode("view-number");
|
||||||
|
if (n != nil)
|
||||||
|
setprop("/sim/current-view/view-number",n.getValue());
|
||||||
foreach (var a; keys(me.axes)) {
|
foreach (var a; keys(me.axes)) {
|
||||||
var n = prop.getNode(a);
|
var n = prop.getNode(a);
|
||||||
me.axes[a].reset();
|
me.axes[a].reset();
|
||||||
|
|
Loading…
Reference in a new issue