MODEL.CFG AND AIRCRAFT.XML
You've exported your interior and exterior models into the appropriate folders within the aircraft package that we created earlier, but there is nothing to link these files to the actual aircraft in the simulation, and so we need to set up the model.cfg
file and also create two XML files for the aircraft - one for the interior and one for the exterior. On this page we'll go through how to make these files and get your aircraft flying in Microsoft Flight Simulator.
model.cfg
This file is very simple to setup and is what is used to tell the simulation what XML files will be used to define the different models used for the different LODS, as well as to define their animations and behaviors. When you first created the aircraft project, the model.cfg
file will have been created for you in the model folder (where you saved the glTF files). However it's rather empty right now!
The first thing we need to do here is setup the [models]
section to point to two files which will defined the aircraft model behaviors. These files don't exist yet - we'll create them later - but we can still give their names here. These files usually follow the same format:
<aircraft_name>.xml <aircraft_name>_interior.xml EG: da62.xml da62_interior.xml
So for our tutorial aircraft, the model.cfg
file will now look like this:
[models] exterior=tutorial_aircraft.xml interior=tutorial_aircraft_interior.xml
The final thing we need to add to this file is the [model.options]
section. This section has some parameters that are used to basically tell the simulation how the interior and exterior models should interact, and a general "rule of thumb" for these options is that if you have an interior model, they should all be set to true
, and if you don't then they should all be set to false
. So, at the top of the file, before the [models] section, add the following:
[model.options] withExterior_showInterior=true withExterior_showInterior_hideFirstLod=true withInterior_forceFirstLod=true withInterior_showExterior=true
Your file should now look like this:
You can now save this file to the "models" folder, which should have the following path:
ROOT\<PackageName>\PackageSources\SimObjects\Airplanes\<AircraftName>\model\model.cfg
Aircraft XML
We now need to create the two XML files that are referenced in the CFG file we just saved. These files are going to be very similar to start with, as all we need them to do is tell the simulation which glTF file to use for each specific LOD. To start with we'll create the exterior XML file, so do that now - creating it in the same location as the model.cfg
file - and name it after the name of your aircraft (eg: da62.xml
), ensuring that you give the same name that you used for the exterior
parameter in the CFG file.
NOTE: If you'd like more information on the different XML elements used in these files, please see here for the appropriate page in the main documentation: Model Definitions.
With the file for the exterior (airframe) of the aircraft created, you can open it and then add in the following:
<?xml version="1.0" encoding="utf-8" ?>
<ModelInfo version="1.0" guid="">
<LODS>
<LOD minSize="150" ModelFile="tutorial_aircraft_LODx0.gltf"/>
<LOD minSize="80" ModelFile="tutorial_aircraft_LODx1.gltf"/>
<LOD minSize="50" ModelFile="tutorial_aircraft_LODx2.gltf"/>
<LOD minSize="25" ModelFile="tutorial_aircraft_LODx3.gltf"/>
<LOD minSize="1" ModelFile="tutorial_aircraft_LODx4.gltf"/>
</LODS>
</ModelInfo>
Once you have that, you can save the file to the same location as the model.cfg
. Note that the values given don't need to be edited right now and you can copy those shown above. If your aircraft has more or less than the five LODs shown in the example code, then simply adapt the values shown as required, but note that the minSize values for the last 3 LODs are usually the same.
For the interior file, you can go ahead and duplicate the XML you just saved, and then renaming it to use the name given in the model.cfg
file for the interior. We'll be keeping the exact same information and only changing the name of the model files to be those of the interior LODs:
<?xml version="1.0" encoding="utf-8" ?>
<ModelInfo version="1.0" guid="">
<LODS>
<LOD minSize="150" ModelFile="tutorial_aircraft_interior_LODx0.gltf"/>
<LOD minSize="80" ModelFile="tutorial_aircraft_interior_LODx1.gltf"/>
<LOD minSize="50" ModelFile="tutorial_aircraft_interior_LODx2.gltf"/>
<LOD minSize="25" ModelFile="tutorial_aircraft_interior_LODx3.gltf"/>
<LOD minSize="1" ModelFile="tutorial_aircraft_interior_LODx4.gltf"/>
</LODS>
</ModelInfo>
Don't worry too much about the actual values given for the LODs right now, as we'll come back to that later. Right now the important thing is to have these three files all prepared and ready as they'll now permit us to load the aircraft into the simulation and start tweaking the flight model and other things.