8,812
edits
 (initial draft)  | 
				No edit summary  | 
				||
| Line 1: | Line 1: | ||
This [[:Category:Howto|howto]] teaches you '''how to set (custom) view points''' for your [[aircraft]](s). In sim, the user can switch between various view points, by pressing the v/V keys.  | This [[:Category:Howto|howto]] teaches you '''how to set (custom) view points''' for your [[aircraft]](s). In sim, the user can switch between various view points, by pressing the v/V keys.  | ||
==Default views==  | ==Default views==  | ||
Various default views are defined in <tt>[[$FG_ROOT]]/preferences.xml</tt> and are used when there is no custom view defined for a certain view-number.    | |||
==Custom views==  | ==Custom views==  | ||
It is possible to configure any number of views with [[XML]] configuration files. Views may be configured to switch between pilot and co-pilot, tower view, or view of an observer on the ground.  | |||
All of the codes mentioned in this article, should be placed between the <sim> and </sim> tag of your aircraft's [[Howto:_Make_an_aircraft#The_-set.xml_file|-set.xml]] file.  | All of the codes mentioned in this article, should be placed between the <sim> and </sim> tag of your aircraft's [[Howto:_Make_an_aircraft#The_-set.xml_file|-set.xml]] file.  | ||
| Line 50: | Line 50: | ||
**'''pitch-offset-deg''' the pitch of the view.  | **'''pitch-offset-deg''' the pitch of the view.  | ||
**'''default-field-of-view-deg''' the larger this number, the wider the view. Around 55-65 is the most common setting.  | **'''default-field-of-view-deg''' the larger this number, the wider the view. Around 55-65 is the most common setting.  | ||
*'''dynamic'''  | |||
**'''enabled''' when set to true, this enables dynamic view, which rotates the view based on control input (to simulate a pilot looking into the direction he steers to).  | |||
* '''limits''' you can limit the view movements, in order to simulate the fact that a human is unable to turn its head 360 degrees.  | * '''limits''' you can limit the view movements, in order to simulate the fact that a human is unable to turn its head 360 degrees.  | ||
**'''enabled''' set to true to enable limits.  | **'''enabled''' set to true to enable limits.  | ||
| Line 59: | Line 61: | ||
Additionally, you can place the following line after the last </view> tag. It is used to define the distance to the aircraft of the default views: chase, helicopter and    | Additionally, you can place the following line after the last </view> tag. It is used to define the distance to the aircraft of the default views: chase, helicopter and    | ||
  <chase-distance-m type="double" archive="y">-90.0</chase-distance-m>  |   <chase-distance-m type="double" archive="y">-90.0</chase-distance-m>  | ||
===View numbers===  | |||
Each view point must have an unique id/number. If no number is set, numbers are assigned from 0 to n in order of existance in the .xml file. Numbers can be overriden by using the following line (where 1 can be any number):  | |||
 <view n="1">   | |||
Since there are various default view points (pilot, helicopter, tower etc.), it is advised to assign numbers starting at 100, when custom views are created. This will make sure that they won't interfer with any default views that may be added in future.   | |||
Note that the view numbers do have impact on the order of views when skipping through them in sim with the v/V keys.  | |||
===Examples===  | |||
====Chase view with fixed roll/pitch degrees====  | |||
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 its location definition, you must set the 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>  | |||
====Tower view====  | |||
  <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>  | |||
Additionally to this, there is a patch [[Howto: Make nice screenshots#Ground to Air|available here]], that let you move the tower's viewpoint around by simply clicking on the terrain.  | |||
[[Category:Aircraft enhancement|Set view points]]  | [[Category:Aircraft enhancement|Set view points]]  | ||
[[Category:Howto|Set view points]]  | [[Category:Howto|Set view points]]  | ||