Howto:Configure views in FlightGear: Difference between revisions

Jump to navigation Jump to search
continuing
(Starting transfer of Jim Wilson's 24 April 2002 how to)
 
(continuing)
Line 100: Line 100:
     <target-lon-deg-path>path-to-property-value</target-lon-deg-path>
     <target-lon-deg-path>path-to-property-value</target-lon-deg-path>
     <target-alt-ft-path>path-to-property-value</target-alt-ft-path>
     <target-alt-ft-path>path-to-property-value</target-alt-ft-path>
===View Offsets===
There are two types of offsets, but only one is used in building viewer configurations. This is an offset from the eye position applied to the position defined for the eye as described in the section on Defining Positon.
These offsets are defined in meters. Here is an example of a Cockpit View definition that includes offsets for the pilot's eye:
<sim>
  <view>
    <name>Cockpit View</name>
    <type>lookfrom</type>
    <internal type="bool">false</internal>
    <config>
      <from-model type="bool">true</from-model>
      <from-model-idx type="int">0</from-model-idx>
      <x-offset-m type="double">-0.22</x-offset-m>
      <y-offset-m type="double">0.30</y-offset-m>
      <z-offset-m type="double">-0.45</z-offset-m>
    </config>
  </view>
</sim>
Note that these offsets are actually best applied differently to specific aircraft models. The size of the aircraft and the actual position of the pilot's seat make a big difference. So typically these offset entries are included per aircraft in the aircraft-set.xml files.
In other circumstances, such as defining a Chase View, you can possibly get away with defining the x-offsets in a more global location so that they apply to all aircraft. Here is an example of a Chase View configuration that includes offsets to define the eye as being 25 meters behind the model origin:
<sim>
  <view>
    <name>Chase View</name>
    <type>lookat</type>
    <config>
      <from-model type="bool">true</from-model>
      <from-model-idx type="int">0</from-model-idx>
      <at-model type="bool">true</at-model>
      <at-model-idx type="int">0</at-model-idx>
      <x-offset-m type="double">0</x-offset-m>
      <y-offset-m type="double">0</y-offset-m>
      <z-offset-m type="double">-25</z-offset-m>
    </config>
  </view>
</sim>
At the time of this writing (and this is subject to change), offsets define the change in eye position as follows:
x-offset-m
    Positive values to the right of origin (view position).
y-offset-m
    Positive values move up from origin.
z-offset-m
    Positive values move back (or in) from origin.
Generally, a higher Near Plane value will result in a better quality rendering of distant scenery and models. Currently when the aircraft is in flight the Near Plane is set at 10 meters.
Any object (including terrain) that is closer to the eye or camera than 10 meters will not be visible. For this reason, when the eye is close to the ground, the Near Plane must be set lower. Here is an example of a Cockpit view that is configured to have only a 0.5 meter Near Plane when sitting on the ground (or below a given flight level which currently defaults to 30ft AGL altitude).
  <view>
    <name>Cockpit View</name>
    <type>lookfrom</type>
    <internal type="bool">false</internal>
    <config>
      <from-model type="bool">true</from-model>
      <from-model-idx type="int">0</from-model-idx>
      <ground-level-nearplane-m type="double">0.5f</ground-level-nearplane-m>
    </config>
  </view>
The example Tower View however, is able to set the value to 10 meters since the tower position is 50ft AGL altitude to start with:
<view>
    <name>Tower View</name>
    <type>lookat</type>
    <config>
      <eye-lat-deg-path>/sim/tower/latitude-deg</eye-lat-deg-path>
      <eye-lon-deg-path>/sim/tower/longitude-deg</eye-lon-deg-path>
      <eye-alt-ft-path>/sim/tower/altitude-ft</eye-alt-ft-path>
      <eye-roll-deg-path>/sim/tower/roll-deg</eye-roll-deg-path>
      <eye-pitch-deg-path>/sim/tower/pitch-deg</eye-pitch-deg-path>
      <eye-heading-deg-path>/sim/tower/heading-deg</eye-heading-deg-path>
      <at-model type="bool">true</at-model>
      <at-model-idx type="int">0</at-model-idx>
      <ground-level-nearplane-m type="double">10.0f</ground-level-nearplane-m>
    </config>
  </view>
=== Other examples ===
Example 1 - The configuration of a Chase View without a rotating frutstum (the view does not tilt with the aircraft's roll and pitch) is easy. Since the aircraft model's orientation is contained in it's location definition, you must set from-model property to false so you may define your own source for position and orientation. Then define eye position properties for the appropriate values. If you leave eye-roll-deg and eye-pitch-deg out then they will be fixed at 0 degrees. Note that technically this example does rotate, but only on the heading :)
  <view>
    <name>Chase View</name>
    <type>lookat</type>
    <config>
      <from-model type="bool">false</from-model>
      <from-model-idx type="int">0</from-model-idx>
      <eye-lat-deg-path>/position/latitude-deg</eye-lat-deg-path>
      <eye-lon-deg-path>/position/longitude-deg</eye-lon-deg-path>
      <eye-alt-ft-path>/position/altitude-ft</eye-alt-ft-path>
      <eye-heading-deg-path>/orientation/heading-deg</eye-heading-deg-path>
      <at-model type="bool">true</at-model>
      <at-model-idx type="int">0</at-model-idx>
      <ground-level-nearplane-m type="double">0.5f</ground-level-nearplane-m>
      <x-offset-m type="double">0</x-offset-m>
      <y-offset-m type="double">0</y-offset-m>
      <z-offset-m type="double">-25</z-offset-m>
    </config>
  </view>
more to come?
Anonymous user

Navigation menu