Walk view
This article is a stub. You can help the wiki by expanding it. |
Updates
Marius_A has started extending Stuart's Tutorials system to also support DFaber's Walker:
Learn more at: FlightGear Missions and Adventures...
Easy walk
This is the most easy walk mode: you just walk at the same level (compared to the plane) and you will not fall if you get outside the plane.
walk.nas
# view nodes and offsets --------------------------------------------
var zNoseNode = props.globals.getNode("sim/view/config/y-offset-m", 1);
var xViewNode = props.globals.getNode("sim/current-view/z-offset-m", 1);
var yViewNode = props.globals.getNode("sim/current-view/x-offset-m", 1);
var hViewNode = props.globals.getNode("sim/current-view/heading-offset-deg", 1);
var walk_about = func(wa_distance) {
var i = getprop("sim/current-view/view-number");
if (i == view.indexof("Pilot View") or i == view.indexof("Model View") or i == view.indexof("View 8")) {
var wa_heading_rad = hViewNode.getValue() * 0.01745329252;
var new_x_position = xViewNode.getValue() - (math.cos(wa_heading_rad) * wa_distance);
var new_y_position = yViewNode.getValue() - (math.sin(wa_heading_rad) * wa_distance);
xViewNode.setValue(new_x_position);
yViewNode.setValue(new_y_position);
}
}
-set.xml
<input>
<keyboard>
<key n="119">
<name>w</name>
<desc>Walk forward toward view</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>walk.walk_about(0.1)</script>
</binding>
</key>
<key n="87">
<name>W</name>
<desc>Walk backward from view</desc>
<repeatable>true</repeatable>
<binding>
<command>nasal</command>
<script>walk.walk_about(-0.1)</script>
</binding>
</key>
</keyboard>
</input>
Advanced walk with jump and parachute
This article or section contains out-of-date information
Please help improve this article by updating it. There may be additional information on the talk page. |
This advanced mode is way more complicated than the easy walk (see above). With this mode you can jump out of the plane and land with a parachute.
walk.nas
See the Pilatus PC-6 Porter's PC-6/Nasal/walk.nas
-set.xml
<walker>
<outside type="bool">false</outside>
<walking type="bool">false</walking>
<speed type="double">0.000006</speed>
<latitude-deg type="double">0.0</latitude-deg>
<longitude-deg type="double">0.0</longitude-deg>
<altitude-at-exit-ft type="double">0.0</altitude-at-exit-ft>
<altitude-ft type="double">0.0</altitude-ft>
<heading-deg type="double">0.0</heading-deg>
<pitch-deg type="double">0.0</pitch-deg>
<roll-deg type="double">0.0</roll-deg>
<internal>
<x-offset-m type="double">4.3</x-offset-m>
<y-offset-m type="double">0.0</y-offset-m>
<z-offset-m type="double">0.0</z-offset-m>
<heading-deg type="double">0.0</heading-deg>
</internal>
<keep-inside-offset-x type="double">0.0</keep-inside-offset-x>
<keep-inside-offset-y type="double">0.0</keep-inside-offset-y>
<keep-inside-offset-z type="double">0.0</keep-inside-offset-z>
<keep-pitch-offset-deg type="double">0.0</keep-pitch-offset-deg>
<key-triggers>
<forward type="double">0</forward>
<outside-toggle type="bool">0</outside-toggle>
<slide type="double">0</slide>
</key-triggers>
<parachute-opened-altitude-ft type="double">0</parachute-opened-altitude-ft>
<parachute-opened-sec type="double">0</parachute-opened-sec>
<starting-trajectory-lat type="double">0</starting-trajectory-lat>
<starting-trajectory-lon type="double">0</starting-trajectory-lon>
<time-of-exit-sec type="double">0</time-of-exit-sec>
</walker>
<input>
<keyboard>
<key n="111">
<name>o</name>
<desc>Toggle walker outside/inside</desc>
<repeatable>false</repeatable>
<binding>
<command>property-toggle</command>
<property>sim/walker/key-triggers/outside-toggle</property>
</binding>
</key>
<key n="119">
<name>w</name>
<desc>Walk forward</desc>
<repeatable>false</repeatable>
<binding n="0">
<command>property-assign</command>
<property>sim/walker/key-triggers/forward</property>
<value>1</value>
</binding>
<binding n="1">
<command>property-assign</command>
<property>sim/walker/speed</property>
<value>0.000006</value>
</binding>
<mod-up>
<binding n="0">
<command>property-assign</command>
<property>sim/walker/key-triggers/forward</property>
<value>0</value>
</binding>
<binding n="1">
<command>property-assign</command>
<property>sim/walker/speed</property>
<value>0.000006</value>
</binding>
</mod-up>
</key>
<key n="87">
<name>W</name>
<desc>Run forward</desc>
<repeatable>false</repeatable>
<binding n="0">
<command>property-assign</command>
<property>sim/walker/key-triggers/forward</property>
<value>1</value>
</binding>
<binding n="1">
<command>property-assign</command>
<property>sim/walker/speed</property>
<value>0.000018</value>
</binding>
<mod-up>
<binding n="0">
<command>property-assign</command>
<property>sim/walker/key-triggers/forward</property>
<value>0</value>
</binding>
<binding n="1">
<command>property-assign</command>
<property>sim/walker/speed</property>
<value>0.000006</value>
</binding>
</mod-up>
</key>
<key n="115">
<name>s</name>
<desc>Walk backward</desc>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>sim/walker/key-triggers/forward</property>
<value>-1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>sim/walker/key-triggers/forward</property>
<value>0</value>
</binding>
</mod-up>
</key>
<key n="97">
<name>a</name>
<desc>Slide left</desc>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>sim/walker/key-triggers/slide</property>
<value>-1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>sim/walker/key-triggers/slide</property>
<value>0</value>
</binding>
</mod-up>
</key>
<key n="65">
<name>A</name>
<desc>Slide left2, override default assignment</desc>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>sim/walker/key-triggers/slide</property>
<value>-1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>sim/walker/key-triggers/slide</property>
<value>0</value>
</binding>
</mod-up>
</key>
<key n="100">
<name>d</name>
<desc>Slide right</desc>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>sim/walker/key-triggers/slide</property>
<value>1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>sim/walker/key-triggers/slide</property>
<value>0</value>
</binding>
</mod-up>
</key>
<key n="68">
<name>D</name>
<desc>Slide right2</desc>
<repeatable>false</repeatable>
<binding>
<command>property-assign</command>
<property>sim/walker/key-triggers/slide</property>
<value>1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>sim/walker/key-triggers/slide</property>
<value>0</value>
</binding>
</mod-up>
</key>
<key n="114">
<name>r</name>
<desc>open parachute</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>walk.open_chute()</script>
</binding>
</key>
</keyboard>
</input>
WalkView: Another option for internal walk views
Another option is to use the WalkView module available in Aircraft/Generic/WalkView/ (in FlightGear 2.2.0 or later). The module supports aircraft internal views that can move around based on a description of the reachable spaces.
Load the WalkView module and the configuration from the -set file. The example below is from Nordstern and makes the view named "Walk View" into a walk view. See also Zeppelin NT and Short Empire for more examples.
<!-- Define the view. -->
<sim>
...
<view n="103">
<name>Walk View</name>
<internal>true</internal>
<config>
<!-- x/y/z == right/up/back -->
<from-model type="bool">true</from-model>
<from-model-idx type="int">0</from-model-idx>
<x-offset-m type="double"> 0.00 </x-offset-m>
<y-offset-m type="double"> -7.50 </y-offset-m>
<z-offset-m type="double"> 51.00 </z-offset-m>
<heading-offset-deg type="double"> 0.0 </heading-offset-deg>
<pitch-offset-deg type="double"> 0.0 </pitch-offset-deg>
<default-field-of-view-deg type="double"> 65 </default-field-of-view-deg>
</config>
</view>
...
</sim>
<!-- Load and configure the WalkView module. -->
<nasal>
<walkview>
<file>Aircraft/Generic/WalkView/walkview.nas</file>
<script>
# The keel walk-way is a long narrow path running in the fore-aft direction.
# Additionally there is a path to the side engine cars.
var keelConstraint =
walkview.makeUnionConstraint(
[
walkview.makePolylinePath(
[
[ 10.0, 0.0, -6.3],
[ 15.0, 0.0, -7.2],
[ 20.0, 0.0, -7.8],
[ 25.0, 0.0, -8.2],
[ 30.0, 0.0, -8.6],
[ 35.0, 0.0, -8.8],
[ 40.0, 0.0, -9.0],
[ 50.0, 0.0, -9.1],
[ 65.0, 0.0, -9.1],
[ 70.0, 0.0, -8.8],
[ 80.0, 0.0, -8.5],
[ 90.0, 0.0, -7.9],
[ 95.0, 0.0, -7.4],
[100.0, 0.0, -6.9],
[105.0, 0.0, -6.2],
[110.0, 0.0, -5.4],
],
0.20),
walkview.makePolylinePath(
[
[ 59.75, -4.90, -7.79],
[ 59.75, -1.70, -9.05],
[ 59.75, 1.70, -9.05],
[ 59.75, 4.90, -7.79],
],
0.20)
]);
# Create the walker for the named view and the given movement restrictions.
var rigger_walker = walkview.Walker.new("Walk View",
keelConstraint);
</script>
</walkview>
...
</nasal>
<!-- Load the default keyboard bindings for the walk view (w/W, a, d, s). -->
<input>
<keyboard include="../Generic/WalkView/walk-view-keys.xml">
...
</keyboard>
...
</input>