Connection between original mesh hierarcy and instance

Hi

Is there a solid way to find each original mesh based on cloned mesh hierarchy created with mesh.instantiateHierarchy? Currently I am hacking it based on on instance mesh ID but I am afraid it will break over time:

const originalMeshId = instance.id.replace('instance of ', '');

Kind regards,
Tommi

You could store it in the mesh.metadata as it is a free bag of data you can use for anything you want ???

Hi

Thank you that is a good advice. Still I am concerned how I need to deduce the information like this:

instance.id.replace('instance of ', '')

I was wondering if instantiateHierarchy method stores or could store the original mesh ID to the cloned mesh for example in the mesh.metadata.

Kind regards,
Tommi

You could flag all the nodes yourself in the callback: onNewNodeCreated?: (source: TransformNode, clone: TransformNode) when calling instantiateHierarchy

This way you can keep track of the information as you see fit ?

1 Like

Oh, nice one, thank you!

-Tommi

1 Like