glTF instance demo not working recently

Below is an instancing example I created previously.
This is a sample that instantiates a glTF model and arranges it to match the shape of the glTF model.
I think it used to work, but when I tried it recently, it no longer worked.
Has there been some change in the specifications?
If I’m using it incorrectly, I would appreciate it if you could tell me the correct way to use it.

I have tested several previous versions, and it seems the behavior has changed between Babylon.js v7.30.0 and v7.30.1

Working: Babylon.js v7.30.0

Not working: Babylon.js v7.30.1

Zoom in on your example, the instances are all there with the addition of a large duckie. I’m on mobile so can’t see right now why the behaviour is different.

1 Like

The changes in the behavior are related to this commit - Fix issue when creating instances from a gltf object (#15724) · BabylonJS/Babylon.js@a630bbd · GitHub
More info here - CreateInstance now parent the instance to the same parent as the source (this is the breaking change).

In your example this breaking change leads to the situation when all duck’s instances are just inside the duck


Hope it helps :slight_smile:

1 Like

Thank you for letting me know about the breaking changes. After making the following adjustments, the sample started working:

const newInstance = colorMeshHash[color].createInstance("instance"+i);
newInstance.parent = null; // ADD
2 Likes