# FlightGear External Model Mini-HowTo

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.

FlightGear uses the open-source PLIB library, which (as of version 1.3.1) includes support for several 3D file formats:

- VRML
- 3DS
- AC3D
- SSG (its native format)
- ASE
- DXF
- TRI
- OBJ
- MD2
- MDL (Microsoft Flight Simulator format)

(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.

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 www.flightsim.com. You then need to install the main model file (with the appropriate extension) somewhere under `$FG_ROOT`, and install any associated textures in `$FG_ROOT/Models/Textures`.

> 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.

Next, you need to set the property `/sim/model/path` to the model file's name, relative to $FG_ROOT.

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.

## Example

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 "`mdl`" and several with extensions ending in "`af`"; you can safely ignore any other files for the installation, but you should, of course, read any files describing your usage rights.

Change to the location of `$FG_ROOT` (`/usr/local/FlightGear` on my system) and copy all of the `*af` texture files to `Models/Textures/`. In Unix, assuming you unzipped in /tmp/cessna

    cp /tmp/cessna/*af Models/Textures

Next, copy to `*.mdl` file to any location under $FG_ROOT; it's probably a good idea to put it inside `Models/`. In Unix

    cp /tmp/cessna/*.mdl Models

To use the model in FlightGear, use the --prop option with the `/sim/model/path` property:

    fgfs --prop:/sim/model/path=Models/C172SKH.mdl

Press the 'v' key to switch to external view, and see how it looks.

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.

## Properties

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

    --prop:/sim/model/h-rotation=180

to turn it around the right way. If the model seems to float a half meter above the ground, you can specify

    --prop:/sim/model/z-offset=0.5

to lower it a bit.

Property | Default | Description
--- | --- | ---
`/sim/model/path` | `Models/Geometry/glider.ac` | The pathname of a file containing a 3D model, relative to `$FG_ROOT`.
`/sim/model/x-offset` | `0.0` | The backward/forward offset in meters. Positive is backwards, negative is forwards.
`/sim/model/y-offset` | `0.0` | The left/right offset in meters. Positive is right, negative is left.
`/sim/model/z-offset` | `0.0` | The up/down offset in meters. Positive is down, negative is up.
`/sim/model/h-rotation` | `0.0` | The heading rotation in degrees. Positive is counter-clockwise, negative is clockwise.
`/sim/model/p-rotation` | `0.0` | The bank rotation in degrees. Positive is left bank, negative is right bank.
`/sim/model/r-rotation` | `0.0` | The pitch rotation in degrees. Positive is nose up, negative is nose down.