[SOLVED] Hardware Instancing with multiple Mesh Instances

Hello fellow developers :slight_smile:

I have seen some examples on Hardware Instancing already. The example on: https://playcanvas.github.io/#graphics/hardware-instancing.html in the code only demonstrates this for a box which only has one mesh instance.

When trying to apply the same technique in a loop over all mesh instances of a model. I get really weird results. Because sometimes mesh instances are parented and therefore have different local scales / positions etc. How would one go about that when setting the matrices with: matrix.setTRS(pos, rot, scl) ?

perhaps this could be a good way to get the matrix:

meshInsntance.node.getWorldTransform()

this gives you the final matrix the mesh is rendered with

3 Likes

Sir, you are a true hero. Thank you

2 Likes