Parenting Instances to Clones?

Hello everyone,

In the example PG below, I created 1000 clones of a box, and 1000 instances of an imported mesh. As you can see from the frame rate, there are no performance issues with having this many objects.

However, for my project, I need the imported mesh instances to be parented to the box clones (long story for why this is the case!).

I’ve tried every combination of the code below that I can think of, and it seems that when the instances are parented to the box clones, the frame rate crashes, or the scene won’t load at all.

To simplify the problem: rabbit instances need to be parented to clone boxes without sacrificing frame rate :smiley: :+1:

Thanks in advance for any help or suggestions!

https://www.babylonjs-playground.com/#D6MY2T

https://www.babylonjs-playground.com/#D6MY2T#1

Is this what you mean?

1 Like

That’s exactly right, thanks @morterra! :smiley: :+1:

I’m using hundreds of high-poly models from Blender in my project, so those will have to be instances to maintain frame rate. However, I learned that instances can’t be parents to sub-meshes, so I need to attach all the mesh instances to hidden clones (which can be parents).

Thanks again for the help!

1 Like