Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Howto:Place 3D objects with the UFO

From FlightGear wiki
Revision as of 13:04, 11 July 2009 by D-79 (Talk | contribs) (Rotating objects)

Jump to: navigation, search

The UFO aircraft is a superb tool for placing a new (or old) 3D object at any arbitrary location in the scenery with just a few clicks of the mouse.

Placing objects in the scenery is a really easy way to contribute to the FlightGear project. It doesn't require any programming knowledge, and you can contribute something valuable in 15 minutes.

Choosing your object

The first thing you need is a 3d model to place in the scenery. The FlightGear Scenery Database (http://scenemodels.flightgear.org/) maintains a huge library of generic models, which will have been included in your FlightGear installation.

If you have created your own model you should save it in a subdirectory of your FG root folder. Two options seem reasonable, although others are possible as well:

a) Save it in the directory Flightgear/data/Models/. That is the standard directory where the UFO will go when you press the Space bar. Let's say you have created a CAT III marker, called catii-iii.xml. In this example, we create a subdirectory Flightgear/data/Models/Tabu/ and save our catii-iii.xml there. The downpoint: The directory Flightgear/data/Models/ is the place where all shared models from the FG Scenery Database are saved and as your universe of own models grows, you might confuse both.

b) You can also save your own models in an other subdirectory like Flightgear/data/mymodels (or any other name). Or if they are shared models which have only one fixed position, like the KSFO terminal, you can save them in the respective subdirectory of the Scenery folder, e.g. Flightgear/data/Scenery/Objects/w130n30/w123n37/mymodels (or directly in w123n37). To browse objects anywhere on your computer, press "L" when using the UFO.

If creating your own object, make sure it is the correct size! In Blender, units are meters and the Caliper script may help. Note that you should not use Google Earth to determine the correct size. See here and here.

Selecting the ufo

Placing objects with UFO html m49fbed81.jpg

Now start Flightgear, and choose UFO as your aircraft.

Placing objects

Once Flightgear has been started, fly with the UFO to the place you want the model to be positioned.

Note that you should not use Google Earth to determine the correct position due to licensing problems. See here and here.

Placing objects with UFO html 5fa8d7b1.jpg

Let's say we want to position the catii-iii.xml object at the end of a taxiway. We stop the UFO just above this intersection and press the space key, a Select Model window will open up where the contents of the Flightgear/data/Models/ directory will be shown (or press "L" and you can go to any desired directory). Select your model from this list, then close the window. The selected model path/name will be display in green text at the bottom left of the FlightGear screen.

Placing objects with UFO html m184fb381.jpg

To place the object, simply left-click on the position that you want to place it. By default it is placed completely horizontal and rotated to point North. It will probably not have the correct orientation and it will be partly covered by the surrounding terrain, but we can adjust that.

Placing objects with UFO html 12ee70a1.jpg

Rotating objects

Fly closer to the ground with the UFO, so that you can see it better.

Now press TAB (or Ctrl-I), and use the resulting sliders to adjust the latitude/longitude/elevation/heading of the model. NB: "Pitch" and "roll" will not be saved, so using them might be fun, but won't help eventually.

Placing objects with UFO html 439816e9.jpg

See the UFO from the 'White Project' of the UNESCO page for more information on the UFO command keys and exported file locations, or press ? while in FlightGear.

Exporting the result

Now that the model is correctly positioned, press the D key to dump the model position data to the terminal. A few lines will be printed on the console, providing the necessary orientation data.

Placing objects with UFO html m4cf0cbf7.jpg

The most important lines are the last ones:

# e000n50/e008n50/3089154.stg 
OBJECT_SHARED Models/Tabu/catii-iii.xml 8.57928135 50.03667992 105.9972 111.1

The first line identified the location of the scenery file for the object. The OBJECT_SHARED line indicates the objects name, longitude, latitude, altitude and orientation. This can be read by FlightGear itself and can be (submitted) to the FlightGear Scenery Object Database.

You can also save these coordinates into your own scenery file so that your changes will not be lost the next time you start FlightGear.

Saving the changes to your scenery

In the terminal window, you get three sections printed out by the UFO with very detailed information about what's going on. We need the lines at the end.

As noted above, the UFO helpfully exports the name of the scenery file where the object's coordinates have to be saved. In our example


The default location for scenery files is Flightgear/data/Scenery/Objects/. Simply open the referenced .stg file, add the OBJECT_SHARED line to the bottom and save the file. Now you have your object's position saved, and it will appear inside the scenery every time you start Flightgear!

In our example we would open 3089154.stg in Flightgear/data/Scenery/Objects/e000n50/e008n50/ and add the following line.

OBJECT_SHARED Models/Tabu/catii-iii.xml 8.57928135 50.03667992 105.9972 111.1

Saving to XML

Alternatively, if you press the E key while developing scenery with Ufo, fgfs will generate an xml file with the dump of your current work in a "ufo-model-export.xml" file. You can later reload this XML file with --config= command-line parameter:

Example for Linux:

fgfs --config=$HOME/.fgfs/ufo-model-export.xml