Walk view

From FlightGear wiki
Jump to navigation Jump to search
This article is a stub. You can help the wiki by expanding it.

Walk view allows the player to walk within and/or outside an aircraft. For example, this can be used to look after (imaginary) passengers while the plane is cruising on autopilot or controlled by another pilot, and to take a walk outside a parked aircraft.

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>

Adding a walker pilot or co-pilot [1]

To add the Walker to your Aircraft replace the <PropertyList> Entry at the top of your -set file with this:

           
<PropertyList include="Aircraft/Generic/Human/Include/walker-include.xml">

This includes all Properties for the Walker, Key Bindings and a Menubar Entry. The Keys "a", "A" and "s" have their normal Binding when not in Walk View or Walker Orbit View.

To have a custom Exit Point add the following Properties to the <model> section in your Aircraft's -set file:

<map>
 <default_exit>
  <x-offset-m type ="float">1</x-offset-m>
  <y-offset-m type ="float">3</y-offset-m>
 </default_exit>
</map>

This specifies where the Walker Model appears.

Creating a pilot/copilot

First, position the Walker Model (walker.xml) below the seat with it's origin (feet) on the Cockpit floor. Then start FlightGear and edit the pose in the Walker animation dialog. When this is done, export the animation and copy the file to a subfolder of the aircraft. This file is referenced in the -set files pilot Properties via "include".

Note: Once the pose is done, the walker.xml entry in the Model file has to be replaced with either pilot.xml or copilot.xml!

The following properties control the appearance of the pilot and co-pilot. They are located in the /sim/model/ section of the -set file:

 <crew>
  <pilot n="0">
   <pose include = "Include/ju52_pilot.xml"></pose>
   <gender>0</gender>
   <character>0</character>
   <outfit>2</outfit>
  </pilot>
  <pilot n="1">
   <pose include = "Include/ju52_pilot.xml"></pose>
   <gender>1</gender>
   <character>0</character>
   <outfit>0</outfit>
  </pilot>
 </crew>

here is an example with one pilot and 2 passengers "npc0" and "npc1" (non player character): In your Aircraft's -set file:

 <crew>
  <pilot n="0">
   <pose include = "Include/ju52_pilot.xml"></pose>
   <gender>0</gender>
   <character>0</character>
   <outfit>2</outfit>
  </pilot>
 </crew>
 <npc n="0">
     <pose include = "Include/ju52_pilot.xml"></pose>
     <gender>0</gender>
     <character>1</character>
     <outfit>0</outfit>
     <hair>2</hair>
 </npc>
 <npc n="1">
     <pose include = "Include/walker_sit.xml"></pose>
     <gender>0</gender>
     <character>0</character>
     <outfit>0</outfit>
     <headgear>1</headgear>
     <eyewear>0</eyewear>
     <mask>0</mask>
     <hair>1</hair>
     <toolr>1</toolr>
 </npc>

and in the aircraft's Model/??????.xml file:

<!-- pilot (no head in pilot view) -->
<model>
		<name>pilot</name>
      <path>Aircraft/Generic/Human/Models/pilot.xml</path>
	  <name>pilot</name>
		<nopreview/>
      <offsets> 
        <x-m>-7.0384</x-m>
        <y-m>-0.4858</y-m>
        <z-m>1.5</z-m>
      </offsets>
</model>

<!--== person sitting next to pilot ==-->	
<model>
      <name>npc0</name>
      <path>Aircraft/Generic/Human/Models/npc0.xml</path>
      <nopreview/>
      <offsets> 
        <x-m>-7.0384</x-m>
        <y-m>0.45</y-m>
        <z-m>1.5</z-m>
      </offsets>
</model>

<!--== person in cabin ==-->	
<model>
	<name>npc1</name>
	<path>Aircraft/Generic/Human/Models/npc1.xml</path>
	<nopreview/>
	<offsets> 
			<heading-deg>90</heading-deg>
			<x-m>-3.2</x-m>
			<y-m>0.65</y-m>
			<z-m>0.90</z-m>
	</offsets>
</model>


Custom movements

Basic Head Movements can be done by including this in the nasal section:

<pilot-movment>
 <file>Aircraft/Generic/Human/Nasal/pilot-movment.nas</file>
 <script>
  var head_x = "sim/model/crew/pilot[0]/pose/position/limb[2]/x-deg";
  var head_y = "sim/model/crew/pilot[0]/pose/position/limb[2]/y-deg";
  var head_z = "sim/model/crew/pilot[0]/pose/position/limb[2]/z-deg";
 </script>
</pilot-movment>

<copilot-movment>
 <file>Aircraft/Generic/Human/Nasal/pilot-movment.nas</file>
 <script>
  var head_x = "sim/model/crew/pilot[1]/pose/position/limb[2]/x-deg";
  var head_y = "sim/model/crew/pilot[1]/pose/position/limb[2]/y-deg";
  var head_z = "sim/model/crew/pilot[1]/pose/position/limb[2]/z-deg";
 </script>
</copilot-movment>

currently(Sept.2016) valid values for the properties

character: 0 1 2

eyewear: 0 no eyewear, 1 sunglasses

gender: 0 male, 1 female, 2 invisible :-)

hair: 0 no hair, 1 hairstyle 1, 2 hairstyle 2,

headgear: 1 headset, 2 big hat, 3 helmet,

mask: 0 no mask, 1 oxygen mask,

outfit: 0, 1, 2, 3, 4,

screenshots of walker characters, outfits and hand gestures

http://www.23hq.com/laserman/album/24944281

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="Aircraft/Generic/WalkView/walk-view-keys.xml">
   ...
  </keyboard>
  ...
 </input>

References

  1. Human [1]

Related content

Wiki articles

Source code