Pick through other meshes

Hello everyone!
Is there any way to ignore mesh (with specific id) from scene.createPickingRay()?

e.q.
we got 2 meshes in a row and you could pick second mesh through the first mesh.
(you can’t use firstMesh.isPickable = false).

or
e.q.
make this code

scene.pick(scene.pointerX, scene.pointerY) 
let ray = scene.createPickingRay(
      scene.pointerX,
      scene.pointerY,
      BABYLON.Matrix.Identity(),
      null
    );
return scene.pickWithRay(ray);

to pick only specific mesh and would ignore other meshes (but not like return false if it’s not right mesh but go through the meshes)

I’d love to make playground but the playground website doesn’t work at this moment… :confused:

Have you tried a predicate function?:
https://doc.babylonjs.com/babylon101/raycasts#predicate-function

2 Likes

that’s it sir! Did the job!