Howto:Place 3D objects with the UFO
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 does not require any programming knowledge, and you can contribute something valuable in just a few minutes.
This article gives an overview of placing, editing and saving objects using the UFO. You can get a list of flying controls and editing commands by pressing thekey while flying the UFO.
Choosing your object
The first thing you need is a 3D model to place in the scenery. The FlightGear Scenery Database (scenemodels.flightgear.org) maintains a huge library of generic models, which will have been included in your FlightGear installation under the $FG_ROOT/Models/ directory. You can skip to the next section when using a generic model.
Creating your own models
Alternatively you can create your own models. You should save it in a subdirectory of your $FG_ROOT folder. Two options seem reasonable, although others are possible as well:
- Shared model, not unique to a single objects (for example a wind turbine): save it in a subdirectory of $FG_ROOT/Models/. That is the standard directory where the UFO will go when you press the space bar .
- Static model, unique object (like the Eiffel Tower): save it in the respective subdirectory of the Scenery folder, e.g. $FG_ROOT/Scenery/Objects/w130n30/w123n37. To browse objects anywhere on your computer, press when using the UFO.
When creating your own object, make sure it is the correct size. In Blender, units are meters. Note that you should be careful about using Google Earth, due to restrictions in their license that might prevent submitting your work to the FlightGear database. See here and here.
Selecting the UFO
Now start FlightGear with the UFO as your aircraft. When launching FlightGear from commandline, use --aircraft=ufo.
Once FlightGear has been started, fly with the UFO to roughly the place you want the model to be positioned.
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 $FG_ROOT/Models/ directory will be shown (or press + and you can go to any desired directory). Select your preferred model from this list, then close the window. The selected model path/name will be displayed in green text at the bottom left of the FlightGear screen.
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 might be partly covered by the surrounding terrain, but we can adjust that.
Fly closer to the ground with the UFO, so that you can see it better.
Now press(or + ), 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.
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.
There are three different ways to three different situations in which which you want to delete an object:
You want to delete the last object that you placed in this session:
- Press the backspace button.
You want to delete an object that you placed in this session, but you have placed one or two models after it:
- That means that it is no longer active. Activate it by placing one more model on the object you want to delete, press the backspace button. Result: The model you want to delete starts blinking, which tells you that it is active.
You want to delete an object that is already saved in the corresponding .stg file and you don't know where it is:
- You don't know the filename: The model you want to delete is probably a shared model. You find it in the scenery database. Now you know the model's file name (e.g. generic_skyscraper_01.ac or Office26x22.xml).
- You still need to know where you find it. Place any model on that building and press Exporting the result below). If there are several objects of that type and you want to delete only one of them, find the one closest to the coordinates of your model placed on top. to know in which file you find it (see
- Open the .stg file, delete the whole model entry (see Exporting the result below). Done.
Exporting the result
Now that the model is correctly positioned, press thekey to dump the model position data to the terminal. A few lines will be printed on the console, providing the necessary orientation data.
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 identifies the location of the scenery file for the object. The OBJECT_SHARED line indicates the object's 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 objects is $FG_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 in $FG_SCENERY/Objects/e000n50/e008n50/3089154.stg and add the following line:
OBJECT_SHARED Models/Tabu/catii-iii.xml 8.57928135 50.03667992 105.9972 111.1
For a short video demonstrating the .stg method, see the following video:
If your are running Windows OS, then please refer to this video:
Saving to XML
Alternatively, if you press the $FG_HOME.key while developing scenery with UFO, FlightGear will generate a xml file with the dump of your current work in an "ufo-model-export.xml" file under
Loading the XML file as part of FlightGear scenery
You can later reload this XML file with --config= command-line parameter:
Example for Linux:
In Windows, this is done using the Advanced dialog, found on the last page of the FGRun GUI. Click Advanced and, under General, click the double-dot button, browse to the ufo-model-export.xml file and click OK.
Sharing your updates with everyone!
Please, once you've improved the scenery around your place, consider sharing it with the community. This is done very easily using our scenery submission webforms. More information and help on the dedicated topic on the scenery forum.