Ray intersections with InstancedMeshes problem. How does it work?

Could you please explain how do intersections with InstancedMeshes work?
My playground
Here I move my instanced mesh out of the ray’s view but why does ray intersects this InstancedMesh?

Or I can even hide my instancedMesh completely from the view:

sphereInstance.setEnabled( false );

and I will still getting intersections with this hidden mesh.

After you reposition your instance you need to use:


or you call intersectsMesh inside runRenderLoop / registerBeforeRender / onBeforeRenderObservable etc.


Wow, that worked like a charm! Thanks for that!

You’re welcome

1 Like