Mesh.clone() seems to break highlightLayer

It seems the highlight on a mesh breaks when you clone it. Is this normal? Here is a PG with the problem: https://www.babylonjs-playground.com/#1KUJ0A#157

It’s not breaking the parent mesh rather superimposing it, I tried changing it’s position and the HL is visible again, I guess, it is something to do with the render order? https://www.babylonjs-playground.com/#1KUJ0A#158

1 Like

https://www.babylonjs-playground.com/#1KUJ0A#161

As you can see, the clone is occluding the highlighted mesh resulting in no highlights. Mesh are drawn in the order they appear in the scene.meshes array.

1 Like

That makes sense. However, in the case I ran into this, I was cloning a mesh to calculate a new rotation using lookAt and then disposing the mesh, so I would never have thought to move the mesh or disable it in any way. In this update PG I dispose the mesh and the highlight is still hidden. Can you explain why? Thanks

https://www.babylonjs-playground.com/#1KUJ0A#162

Fix is in master: Fix clone observables by sebavan · Pull Request #5625 · BabylonJS/Babylon.js · GitHub

It will be deployed soon, it came from observables being cloned.