3D Model rotates around the nose

From FlightGear wiki
Jump to navigation Jump to search
This article is a stub. You can help the wiki by expanding it.
Cleanup.png This article may require cleanup to meet the quality standards of the wiki. Please improve this article if you can.

A sort of "optical illusion" occurs when the 3D model origin is positioned at the nose. Often the FDM models are configured so that 0,0,0 is located at the "nose". In order to have the 3D model positioned correctly in the 3D world, it should have an origin at the "nose" as well.

The problem is this doesn't "look" right. The cause of this problem is similar to the experience of looking out the window of a stopped train and thinking you are moving when it is actually the train next to you going the other way. 3D Rendering does the same sort of thing. Since you are looking through a "2D window" on your screen you tend to lose the "fixed references" that in the real world help you see how something is really moving. In the case of the external "views" (anything not in the cockpit) of FlightGear you have to remember that the camera (and therefore your eye) is tied to the motion of the aircraft and is always focused on the point that the FDM outputs. You can move that 3D model anywhere you want and it will always appear to move around whereever you have the 3D model's origin set, regardless of where the real movement occurs.

To counteract the effect you need to tell the viewer's camera to look elsewhere. So pick a spot where you think the aircraft should look like it is rotating and then provide view "target" offsets to that location. In most cases this just means moving the target location back toward the wings of the aircraft. Keep in mind that you are merely controlling the way FlightGear renders the image. You are not moving the aircraft's location, or changing the data that drives the instruments, or affecting the way it flies. The following entries in the p51d-set.xml file add this "offset" to the various external views of the P51-D. These entries cause the external view camera to point at a location that is 3.949 meters behind the nose of the aircraft in four different views:

<view n="1">
  <config>
   <target-z-offset-m archive="y" type="double">3.949</target-z-offset-m>
  </config>
 </view>

 <view n="2">
  <config>
   <target-z-offset-m archive="y" type="double">3.949</target-z-offset-m>
  </config>
 </view>

 <view n="3">
  <config>
   <target-z-offset-m archive="y" type="double">3.949</target-z-offset-m>
  </config>
 </view>

 <view n="4">
  <config>
   <target-z-offset-m archive="y" type="double">3.949</target-z-offset-m>
  </config>
 </view>