When cloning a mesh with ADT, the ADT does not attach to the cloned mesh

In this PG - https://playground.babylonjs.com/#NJQ3JC#86, I am creating a mesh with an ADT and then creating instances of it. I noticed that my pointer observables are not firing, nor is my cursor updating on hover. I traced the problem to when the ADT was created, the pointer observable function is comparing the picked mesh to the original mesh passed in to CreateForMesh. When I clone a mesh with an adt, should I expect the ADT to attach to the new mesh? I see the attachToMesh is public. Can I call that in my clone handler on instantiateHierarchy?

Adding @carolhmj our own Babylon GUI expert :slight_smile:

Looks like you are back to the cloning of ADT option?
May I just ask you how are the results now after the fix (regarding this topic of yours)?

Did you have a chance to run a new test? Would you say that this option is now a viable option?
Thanks,

Yes. I have to go the ADT route because of some requirements that emerged (pointer events on the UI and a unique label on each UI). I haven’t rerun my test yet after the PR, but I will today and will post results in the original thread.

1 Like

Hello!

When I clone a mesh with an adt, should I expect the ADT to attach to the new mesh?

Cloning a mesh doesn’t clone the materials by default, so that won’t happen automatically. I believe the correct way indeed will be to call attachToMesh, and also keep in mind to add any pointer events that were in the original ADT, since the pointer events aren’t cloned too: Test clone control with ADT | Babylon.js Playground (babylonjs.com)

1 Like