[Solved] The engine seems not to load the substructures of GLB models properly

Model


Substructrue
Sub

Spatial tank = assetManager.loadModel(“/assets/Models/Tank.glb”);
tank.scale(5.0f);
rootNode.attachChild(tank);

The shape of the child object “Sub1” is not loaded as what I have modelled in Blender.

Please test if it loads fine in the below online gltf viewers:


babyjson

All of them loaded properly except the engine.

1 Like

Could you upload the model here?

1 Like

(Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.)
maybe i need use the older version of blender?
The version im using now is blender 3.4.

1 Like

I linked everything to this issue I believe is yours: Cannot load sub-structure in ".glb" model exported by blender 3.4 . · Issue #1954 · jMonkeyEngine/jmonkeyengine · GitHub

1 Like

Applying “scale” in blender fixed it for me.

In the blender, select all parts and press Ctrl+A key → select “Scale”.

Which makes me wonder what options were selected in the GLTF exporter.

I noticed the main issue is that you have parented a geometry to another geometry in Blender. In JME you can only parent a geometry to a node.

Select FactionColor.Cannon object and press Alt+P → and select “Clear and Keep Transformation”.

It should resolve the issue as well.

1 Like



Code2
Structure in blender

The problem is not that easy.
The node of the sub-structure and parent relationship will be automatically recognized by the engine. But the shape is not the same. I think there may be some bugs in assetManager.loadModel();

Note, even Blender can not import it correctly.

See the differences

The below one is the original one and the above one is loaded from Tank.glb.

2 Likes

Or could be vice versa!
that the original one (the blend file that you said you created in blender v3.4) is not opened correctly for me because I am opening it with Blender v3.0 :slightly_smiling_face:

Oh, I have noticed what’s wrong a had made.

I used to change the scale of the object to get the correct shape in the “object mode” which makes the child structure use the same scale in the engine.

The correct way to change the shape of these geometries in blender should in the “edit mode”.

Thanks a lot for your help xD

2 Likes

Keep the scale of these geometries always be 1.
Don’t change the scale easily, use the edit mode to change the shape.

1 Like

…and again…

One of the options is to apply transforms which often gets rid of the issue you describe.

Hmm, I can not find this option in GLTF exporter.
FYI, I am using Blender 3.0.

I just looked and it’s “Apply Modifiers” that I was thinking of… which is obviously not the same thing.

It must have been “better object/edit discipline” that has prevented me from having this issue in a long time.