Pivot Matrix are not being copied while cloning the mesh. Bug or feature?

I created a merged mesh, but it’s registration point (the one I get with mesh.position) is way off. So, I have to fix it manually using setPivotMatrix.

However, when I try to clone the mesh, the edited pivot matrix is not preserved.
https://playground.babylonjs.com/#IJDX02#2

The pivot matrix is preserved when cloning a mesh. If you get the pivot matrix of monsterInstance2, you will see it has the translation you set line 57.

Then why is the cloned mesh drawn above its monsterInstance2.position? This is what I fixed with setPivotMatrix on original mesh, but this fix didn’t survive the cloning.

There was a bug indeed! Here’s the fix:

1 Like