Mesh.clone() does not play well with Thin Instance

Hi there,

It seems that even after cloning a mesh, all clones are still sharing the same Thin Instance capabilities, i.e. make 10 clones, create Thin Instances for each of them, and only the last call to mesh.thinInstanceSetBuffer( 'matrix' , ... ) produces something, previous calls seems to be overwritten.

Use case: I’m currently planting tree on a rather big map, each map sector having its own set of Thin Instance (so a sector can be turned off when it’s too far away).

Playground demonstrating the bug: Playground.
It’s based on the example with four cubes, but here the blue and green cube are not based upon a freshly created cube, but from a clone. The bug removes the red and yellow cubes as soon as the clone calls cube2.thinInstanceSetBuffer().

1 Like

Hey there, you need to call makeGeometryUnique() on the clone, then you can set thin instance buffers for both of them. :slight_smile:

4 Likes

@Blake Ah ok, it works like a charm now!
Thanks a lot for the quick reply! :wink:

2 Likes