648
edits
No edit summary |
|||
Line 51: | Line 51: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Alternatively you can assign the reset functionality to a button. In the following example clicking on the button resets the headtracker if in the default pilot view. Otherwise it gets back to the pilot's view. | |||
<syntaxhighlight lang="xml"> | |||
<button> | |||
<number> | |||
<unix>13</unix> | |||
<windows>1</windows> | |||
</number> | |||
<desc>Reset view and cockpit view; SHIFT = next view</desc> | |||
<binding> | |||
<command>nasal</command> | |||
<script> | |||
<![CDATA[ | |||
if (getprop("/sim/current-view/view-number") > 0) { | |||
setprop("/sim/current-view/view-number", 0); | |||
setprop("/sim/current-view/goal-pitch-offset-deg", getprop("/sim/view[0]/config/pitch-offset-deg")); | |||
setprop("/sim/current-view/goal-heading-offset-deg", 0.0); | |||
} else { | |||
headtracker.reset(); | |||
} | |||
]]> | |||
</script> | |||
</binding> | |||
</button> | |||
</syntaxhighlight> | |||
== Troubleshooting == | == Troubleshooting == |
edits