ThinInstances and GlobalMatrix

PG: ThinInstance & WorldMatrix | Babylon.js Playground (

Hi, I have not been able to understand how to play with globalMatrix and ThinInstance.

I have more complex scenes but here i have reproduced one with just 9 cubes.

I create the array of all the worldMatrix of those 9 cubes.

I try to apply this array to a thinInstanceAdd but the result is not coinciding with the original scene.

If you comment line 53 ( matchingMeshes[i].dispose(); ) you can see the original meshes.

I have made a check of each matrix of the original meshes vs the thininstance, and the console shows 9 are ok, 0 are not.

Any help is appreciated!

This is an example applied to Petals. Original Meshes

Those are the thinInstances with worldMatrix applied

Thanks so much

(This is my first post, sorry for any non compliance :slight_smile:

You were close :slight_smile:
Call computeWorldMatrix to …well compute it. Otherwise, it will be updated lated when rendering.
Then, you can get it and use it for a thin instance.

1 Like

Wow. Thanks Great contribution. I Am almost there .

As you can see from this original image

Thin Instances are moved somehow bottom left

How to fix also that > And have the thin instances in the same position of the original mesh ?

yes, the original mesh is the ‘parent’ of the instances.