plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.

In the upcoming flighting, we've changed the behaviour of the content.xml file. If your addon uses this file, please read this article!

Please take a moment to read the platform’s guidelines before you get started!


question

Richie81 avatar image
Richie81 asked Paavo commented

Model attachment

Thanks so much for the new feature. I was looking at the documentation and the examples. Having a hard time to actually accomplish this. I have done as the example bellow, but I don't get this to show. I made the node on the GTLF, and made the separate xml and gtlf file for the attaching model. But to no avail. Read many times the documentation, don't know what I am doring wrong, I get a warning on compile saying node 0 not found or something to that effect. Can you folks explain a bit more how this is accomplished?


<ModelInfo>
    <LODS>
        <LOD minSize="150" ModelFile="DA62_LOD00.gltf">
            <MergeModel>..\livery\DA62_LiveryFS_LOD00.gltf</MergeModel>
            <AttachModel id="myInstrument"/>
            <AttachModel id="chair1"/>
        </LOD>
        <LOD minSize="110" ModelFile="DA62_LOD01.gltf">
            <AttachModel id="chair1"/>
        </LOD>
        <LOD minSize="75" ModelFile="DA62_LOD02.gltf"/>
    </LODS>
    <ModelAttachments>
        <ModelAttachment id="myInstrument">
            <AttachToNode>SomeNodeName</AttachToNode>
            <Model>..\..\..\..\Instruments\SomeInstrument.xml</Model>
        </ModelAttachment>
        <ModelAttachment id="chair1">
            <AttachToNode>chair1pos</AttachToNode>
            <Model>..\..\Shared\Misc\FancyChair.xml</Model>
        </ModelAttachment>
    </ModelAttachments>
</ModelInfo>
modeling
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

virtuali avatar image
virtuali answered Richie81 commented

Ok, maybe I see what's wrong: in your last XML, you put the <AttachModel> tag alongside the LOD. tag. It must be *inside* like this:

<LOD minSize="150" ModelFile="A321_NEO_LOD00.gltf">
  <AttachModel id="child_model"/> 
</LOD>

I assure you the feature works very good, we are using it extensively in GSX for MSFS...


2 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Umberto, when you compile your package, you get the models and such generated? because I am not getting any error messages but I am not getting the gtlf's and such generated in the package when I compile. Might be something wrong I am doing with the way I have it set up then.
0 Likes 0 ·
Never mind Umberto, got it sorted, had the code broken somewhere. Thanks!
0 Likes 0 ·
virtuali avatar image
virtuali answered

the node chair1pos likely doesn't exists inside DA62_LOD00.gltf

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Paavo avatar image
Paavo answered Paavo commented

The SDK example is too confusing.

Here is a minimal example:

<ModelInfo guid="{daba6ada-f090-4a4c-b0f0-f91f30932b4b}" version="1.1">
<LODS>
    <LOD ModelFile="parent_LOD0.gltf" minSize="30">
      <AttachModel id="child_model"/>
    </LOD>
    <LOD ModelFile="parent_LOD1.gltf" minSize="10">
      <AttachModel id="child_model"/>
    </LOD>
    <LOD ModelFile="parent_LOD2.gltf" minSize="5">
      <AttachModel id="child_model"/>
    </LOD>
    <LOD ModelFile="parent_LOD3.gltf" minSize="3"/>
</LODS>
  <ModelAttachments>
    <ModelAttachment id="child_model">
      <AttachToNode>attachment_point</AttachToNode>
      <Model>..\model.child\model.xml</Model>
    </ModelAttachment>
  </ModelAttachments>
</ModelInfo>

This example assumes that you have two model folders model.parent and model.child with such structure:

[D] SimObject root
├─ [D] model.parent
├─ [F] model.xml ← The file above
├─ [F] parent_LOD0.gltf
├─ [F] parent_LOD1.gltf
├─ [F] parent_LOD2.gltf
[F] parent_LOD3.gltf
[D] model.child
├─ [F] model.xml ← The referenced child model
[F] (glTF files ...)
─ [D] texture ← Both child and parent will use textures from parent's texture folder

The parent model has four LOD sizes and each separate model contains node named attachment_point where the child model will be attached. Keep in mind that sizes below 5 will not show attachments.

You can of course include models from the same folder too, they don't have to be in separate folders. Child object can be any standard model and include its own LODs, which will be calculated separately.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Richie81 avatar image
Richie81 answered

I am still getting a red warning message "model attachment 0" on compile. Don't know what I can be doing wrong. In 3ds max I named the node 'attachment_point"

here is what I get

imageupload.jpg

I have tried everything, and its impossible. This is a simobject


imageupload.jpg (192.3 KiB)
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

virtuali avatar image
virtuali answered

Difficult to help you without looking at your xml file too.

In your first post, you showed an xml calling the default DA62 models so, the reason why you got the error about chair1pos, was there is no chair1pos node in the default DA 62 gltfs.

Now, it seems you are doing something derived from the default A320 but, if you are still including the original .GLTFs, to attach something on it, you must use a node that exists there.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Richie81 avatar image
Richie81 answered

Thanks Umberto, actually is my own gtlf, here is a sample of the xml

<ModelInfo>
<LODS>
<!-- Highest LOD -->
<!-- minimum display size in % (should be bounding sphere vertical screen size, sphere will often be slightly larger than you expect) -->
<!-- default minSize is 0 -->
<LOD minSize="150" ModelFile="A321_NEO_LOD00.gltf"/>
<AttachModel id="child_model"/>
<LOD minSize="80" ModelFile="A321_NEO_LOD01.gltf"/>
<AttachModel id="child_model"/>
<LOD minSize="50" ModelFile="A321_NEO_LOD02.gltf"/>
<AttachModel id="child_model"/>
<LOD minSize="15" ModelFile="A321_NEO_LOD03.gltf"/>
<AttachModel id="child_model"/>
</LODS>
<ModelAttachments>
<ModelAttachment id="child_model">
<AttachToNode>attachment_point</AttachToNode>
<Model>model.xml</Model>
</ModelAttachment>
</ModelAttachments>


I put the attached (child) model in the same folder where I have this parent GTLF

I did a node called 'attachment_point' in the gtlf

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

virtuali avatar image
virtuali answered virtuali edited

You mean you created your own version of all the A321_NEO GLTFs, which have been modified by adding the attachment_point node ? That would be the only way for it to work.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Richie81 avatar image
Richie81 answered Richie81 edited

Hi Umberto, yes on my own GLTF's. I just tried doing it with the default DA62, and get the same error.

I had thought the issue may be on my node name. I don't know.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Richie81 avatar image
Richie81 answered

Thanks so much Umberto, I think that was the mistake, now I am not getting that error message. Thank you!

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.