MergeMesh destroys mesh animations

Hello, I tried to use the Mesh.MergeMeshes function at a model that consists of 4 meshes.
The main problem is that no mesh animation is playing any more.
Secondly, the light seems to has been strangely reversed on the model!
And third, that I had to scale up the model 100 times in order to come to the previous original size.

Here is a PG with the problematic scene:

Am I doing something wrong here?

For animations: this is expected as the new mesh IS a new mesh and does not inherit from animations

same for scaling: the new mesh is just the merge of the geometries. Nothing else is inherited.

The ultimate question would be: Why do you need to merge the meshes? Furthermore if they are animated

1 Like

Well, its better to handle one Mesh than 4! :slight_smile:
And why the MergeMeshes function exists if there is no reason to merge meshes.

So, is there a way to attach the animations and skeletons to my new mesh?

And finally, what about the inverted light?

MergeMeshes is more to merge static meshes to send big batches of geometry to the GPU

You can still attach your skeleton afterwards.

My question is more: why not just doing that in your DCC tool? why consuming realtime CPU for that?

To your light question: as you are loading a gltf file, the system needs to add a parent (root) which is in charge on inverting the coordinates system from right handed (glTF) to left handed (Babylonjs). By merging the meshes you are losing all this as well

For the lighting problem, you should set scene.useRightHandedSystem = true; right after the scene is created, to be in sync with the handedness of the gltf file.