Howto:Configure views in FlightGear: Difference between revisions

Jump to navigation Jump to search
cleanup
(cleanup)
Line 1: Line 1:
===Introduction===
===Introduction===
This mini-HOWTO explains how to configure views in FlightGear. Views define the position of the eye in the rendered scene and what if any object the eye is focused on or tracking. The eye is the imaginary or constructed eye that is simulated by the 3D rendering. It makes the picture on your screen represent what things would look like if you were standing or sitting at a given location.
This mini-HOWTO explains how to configure views in FlightGear. Views define the position of the eye in the rendered scene and what if any object the eye is focused on or tracking. The eye is the imaginary or constructed eye that is simulated by the 3D rendering. It makes the picture on your screen represent what things would look like if you were standing or sitting at a given location.


Line 6: Line 5:


===Types of Views===
===Types of Views===
There are two basic types of views:
There are two basic types of views:


'''LookFrom''' - This type requires a single coordinate position. The direction of the view is independant of any particular object. Adjusting the heading and pitch offsets moves the direction of observation around. In the default Flight Gear configuration panning with the mouse will move the view around as if the observer was turning their head.
* '''LookFrom''' - This type requires a single coordinate position. The direction of the view is independant of any particular object. Adjusting the heading and pitch offsets moves the direction of observation around. In the default Flight Gear configuration panning with the mouse will move the view around as if the observer was turning their head.
 
* '''LookAt''' - This type requires a two coordinate positions. The direction of the view is always oriented toward a target and tracks the target if it moves.
'''LookAt''' - This type requires a two coordinate positions. The direction of the view is always oriented toward a target and tracks the target if it moves.


(see configuration examples below for usage of the <type> paramter)
(see configuration examples below for usage of the <type> paramter)


===Defining Positions===
===Defining Positions===
There are two methods to define a postion and orientation for use in configuring a view. One method is tied to a model which means the view references the position and orientation of a model (e.g. Aircraft 3D Model) and the other is an idependant postion which simply means that the view references location data directly (via the Flight Gear property tree):
There are two methods to define a postion and orientation for use in configuring a view. One method is tied to a model which means the view references the position and orientation of a model (e.g. Aircraft 3D Model) and the other is an idependant postion which simply means that the view references location data directly (via the Flight Gear property tree):


Tied to a Model - This method allows definition of the "eye", that is where you are looking from and/or the "target" or objected being looked at based on a model position and orientation. The following illustrates defining the positon of a "Cockpit View" that is positioned and oriented according to the position and orientation of a model:
'''Tied to a Model''' - This method allows definition of the "eye", that is where you are looking from and/or the "target" or objected being looked at based on a model position and orientation. The following illustrates defining the positon of a "Cockpit View" that is positioned and oriented according to the position and orientation of a model:


  <sim>
  <sim>
Line 34: Line 30:




Syntax for the eye position is:
Syntax for the '''eye position''' is:


     <from-model type="bool">true or false</from-model>
     <from-model type="bool">true or false</from-model>
     <from-model-idx type="int">modelnumber</from-model-idx>
     <from-model-idx type="int">modelnumber</from-model-idx>


Syntax for the target or at position used in views of type "lookat" is:
Syntax for the target or '''at position''' used in views of type "lookat" is:


     <at-model type="bool">true or false</at-model>
     <at-model type="bool">true or false</at-model>
Line 46: Line 42:
Note that from-model or at-model must be true in order for the position and orientation data from the model to be used.
Note that from-model or at-model must be true in order for the position and orientation data from the model to be used.


Independant Position - This method allows definition of the eye, that is where you are looking from or the target (objected being looked at) based on arbitrary position and orientation data obtained from the property tree (i.e. any source). The following illustrates a Tower defined as a "lookat", a view that can be used to track or follow a moving model:
'''Independant Position''' - This method allows definition of the eye, that is where you are looking from or the target (objected being looked at) based on arbitrary position and orientation data obtained from the property tree (i.e. any source). The following illustrates a Tower defined as a "lookat", a view that can be used to track or follow a moving model:
 


  <sim>
  <sim>
Line 70: Line 65:
Note that the definition is constructed as a path to a numeric data item in the global property tree. If you are unfamiliar with these properties, take a look at the "Property Picker" dialog while Flight Gear is running and you can see the kinds of values in use. You may define your own static values, say for a fixed location of an observer, by adding the following xml to your setup (prefrences.xml or another file):
Note that the definition is constructed as a path to a numeric data item in the global property tree. If you are unfamiliar with these properties, take a look at the "Property Picker" dialog while Flight Gear is running and you can see the kinds of values in use. You may define your own static values, say for a fixed location of an observer, by adding the following xml to your setup (prefrences.xml or another file):


<somepath>
<somepath>
   <ground-observer-lon-deg>48.6124</ground-observer-lon-deg>
   <ground-observer-lon-deg>48.6124</ground-observer-lon-deg>
   <ground-observer-lat-deg>63.1243</ground-observer-lat-deg>
   <ground-observer-lat-deg>63.1243</ground-observer-lat-deg>
   <ground-observer-alt-ft>123.5</ground-observer-alt-ft>
   <ground-observer-alt-ft>123.5</ground-observer-alt-ft>
</somepath>
</somepath>


These values can then then be referenced in your view by including their path in the definition. For example to reference the above longitude for the ground observer:
These values can then then be referenced in your view by including their path in the definition. For example to reference the above longitude for the ground observer:
Line 86: Line 81:


All three longitude, latitude, and altitude must be defined to have a valid position (otherwise the missing items default to 0). You may also define orientation such as heading (the direction to look toward) and pitch (the angle up or down to be looking). In the case of a cockpit view the orientation will be that of the aircraft itself, but in the case of a "lookfrom" view like a ground observer or tower it can be an arbitrary view direction that is either static, or changing.
All three longitude, latitude, and altitude must be defined to have a valid position (otherwise the missing items default to 0). You may also define orientation such as heading (the direction to look toward) and pitch (the angle up or down to be looking). In the case of a cockpit view the orientation will be that of the aircraft itself, but in the case of a "lookfrom" view like a ground observer or tower it can be an arbitrary view direction that is either static, or changing.
Syntax for the eye position and orientation is:
 
Syntax for the '''eye position and orientation''' is:


     <eye-lat-deg-path>path-to-property-value</eye-lat-deg-path>
     <eye-lat-deg-path>path-to-property-value</eye-lat-deg-path>
Line 95: Line 91:
     <eye-heading-deg-path>path-to-property-value</eye-heading-deg-path>
     <eye-heading-deg-path>path-to-property-value</eye-heading-deg-path>


Syntax for the target or at position used in views of type "lookat" is:
Syntax for the target or '''at position''' used in views of type "lookat" is:


     <target-lat-deg-path>path-to-property-value</target-lat-deg-path>
     <target-lat-deg-path>path-to-property-value</target-lat-deg-path>
Line 102: Line 98:


===View Offsets===
===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'''.


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:


These offsets are defined in meters. Here is an example of a Cockpit View definition that includes offsets for the pilot's eye:
<sim>
 
<sim>
   <view>
   <view>
     <name>Cockpit View</name>
     <name>Cockpit View</name>
Line 121: Line 116:
     </config>
     </config>
   </view>
   </view>
</sim>
</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.
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.
Line 127: Line 122:
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:
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>
<sim>
   <view>
   <view>
     <name>Chase View</name>
     <name>Chase View</name>
Line 142: Line 137:
     </config>
     </config>
   </view>
   </view>
</sim>
</sim>


At the time of this writing (and this is subject to change), offsets define the change in eye position as follows:
At the time of this writing (and this is subject to change), offsets define the change in eye position as follows:
Line 217: Line 212:
more to come?
more to come?


[[Category:Howto]]
[[Category:Howto|Configure views in FlightGear]]

Navigation menu