<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Flightgear External Model Mini-HowTo</title> </head> <body bgcolor="white"> <h1>FlightGear External Model Mini-HowTo</h1> <img src="model.jpg" /> <p>FlightGear now supports external views with user-defined 3D models. Eventually, FlightGear will probably support a single definition file that specifies a package containing a flight model, engine model, panel, external 3D model, and sounds; for now, however, users must specify each of these separately.</p> <p>FlightGear uses the open-source <a href="http://plib.sourceforge.net/">PLIB</a> library, which (as of version 1.3.1) includes support for several 3D file formats:</p> <ul> <li>VRML</li> <li>3DS</li> <li>AC3D</li> <li>SSG (its native format)</li> <li>ASE</li> <li>DXF</li> <li>TRI</li> <li>OBJ</li> <li>MD2</li> <li>MDL (<cite>Microsoft Flight Simulator</cite> format)</li> </ul> <p>(Note that some of these have restrictions; see the PLIB documentation for details.) As new formats are added to PLIB, FlightGear will automatically be able to support them.</p> <p>First, you need to find a 3D model for the aircraft you want to see during an external view. Your best bet is probably to download an MSFS MDL file from one of the many flight-simulator Web sites, such as <a href="http://www.flightsim.com/">www.flightsim.com</a>. You then need to install the main model file (with the appropriate extension) somewhere under <code>$FG_ROOT</code>, and install any associated textures in <code>$FG_ROOT/Models/Textures</code>.</p> <blockquote> <p><strong>NOTE: if your model appears untextured and you are using a case-sensitive filesystem, you may need to fiddle with the case of the texture file names.</strong></p> </blockquote> <p>Next, you need to set the property <code>/sim/model/path</code> to the model file's name, relative to $FG_ROOT.</p> <p>It is possible that the model may not be aligned correctly, and will appear to fly too high, too low, sideways, vertically, etc. If so, you can use the additional properties described at the end of this mini-howto to adjust to model so that it appears to fly realistically.</p> <div> <h2>Example</h2> <p>You have downloaded a zip package containing a 3D Cessna model for Microsoft Flight Simulator, and you want to use that model in FlightGear. First, you unzip the package, where you find a series of files, including one with the extension "<code>mdl</code>" and several with extensions ending in "<code>af</code>"; you can safely ignore any other files for the installation, but you should, of course, read any files describing your usage rights.</p> <p>Change to the location of <code>$FG_ROOT</code> (<code>/usr/local/FlightGear</code> on my system) and copy all of the <code>*af</code> texture files to <code>Models/Textures/</code>. In Unix, assuming you unzipped in /tmp/cessna</p> <pre> cp /tmp/cessna/*af Models/Textures </pre> <p>Next, copy to <code>*.mdl</code> file to any location under $FG_ROOT; it's probably a good idea to put it inside <code>Models/</code>. In Unix</p> <pre> cp /tmp/cessna/*.mdl Models </pre> <p>To use the model in FlightGear, use the <var>--prop</var> option with the <code>/sim/model/path</code> property:</p> <pre> fgfs --prop:/sim/model/path=Models/C172SKH.mdl </pre> <p>Press the 'v' key to switch to external view, and see how it looks.</p> <p>If the model does seem to have the correct position or orientation, you can adjust it using the properties described below. When everything is correct, you can add the properties to your .fgfsrc file so that you do not have to type them every time.</p> <!-- end of "Example" --> </div> <div> <h2>Properties</h2> <p>These properties allow you to specify the path of the 3D model for external views and to adjust the model's position and orientation so that it seems to fly in the correct position. For example, if the model is pointing backwards, you can specify</p> <pre> --prop:/sim/model/h-rotation=180 </pre> <p>to turn it around the right way. If the model seems to float a half meter above the ground, you can specify</p> <pre> --prop:/sim/model/z-offset=0.5 </pre> <p>to lower it a bit.</p> <table border="1"> <thead> <tr> <th>Property</th> <th>Default</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>/sim/model/path</code></td> <td align="center"><code>Models/Geometry/glider.ac</code></td> <td>The pathname of a file containing a 3D model, relative to <code>$FG_ROOT</code>.</td> </tr> <tr> <td><code>/sim/model/x-offset</code></td> <td align="center"><code>0.0</code></td> <td>The backward/forward offset in meters. Positive is backwards, negative is forwards.</td> </tr> <tr> <td><code>/sim/model/y-offset</code></td> <td align="center"><code>0.0</code></td> <td>The left/right offset in meters. Positive is right, negative is left.</td> </tr> <tr> <td><code>/sim/model/z-offset</code></td> <td align="center"><code>0.0</code></td> <td>The up/down offset in meters. Positive is down, negative is up.</td> </tr> <tr> <td><code>/sim/model/h-rotation</code></td> <td align="center"><code>0.0</code></td> <td>The heading rotation in degrees. Positive is counter-clockwise, negative is clockwise.</td> </tr> <tr> <td><code>/sim/model/p-rotation</code></td> <td align="center"><code>0.0</code></td> <td>The bank rotation in degrees. Positive is left bank, negative is right bank.</td> </tr> <tr> <td><code>/sim/model/r-rotation</code> <td align="center"><code>0.0</code></td> <td>The pitch rotation in degrees. Positive is nose up, negative is nose down.</td> </tr> </tbody> </table> <!-- end of "Properties" --> </div> <hr /> <address>David Megginson, <a href="mailto:david@megginson.com">david@megginson.com</a>, 2000-11-08</address> </body> </html>