Hi all,
I have multiple (two for now ) meshes above each other with diferent zOffset, they all have isPickable=true, when I check pickInfo.pickedMesh it does not pick closest mesh.
How to control wich mesh will be picked?
Thnx
Hi all,
I have multiple (two for now ) meshes above each other with diferent zOffset, they all have isPickable=true, when I check pickInfo.pickedMesh it does not pick closest mesh.
How to control wich mesh will be picked?
Thnx
Make sure that the fastCheck
parameter is not set to true
, else it will take the first intersection found, and not the closest.
Where can I change fastCheck
parameter?
For instance: Babylon.js docs
Just an FYI because I found this confusing when I was new to Babylon. “first intersection found” refers to the loop of the raycast. If meshes[0] intersects, the raycast returns that intersection - even if meshes[1] is closer to the ray origin.
So fastCheck is useful when you want to know “does ray hit anything?”. But if you need intersection details, fastCheck is bad.