How to disable OnPointerOverTrigger triggering meshes that are behind another one?

As it states in the title: how can I do that?

Here a PG, I got 2 boxes to which an actionManager is attached, I’ve set the camera in the right position so you’ll see the unwanted effect quickly

https://playground.babylonjs.com/#RMZC85#5

Hello!

I would recommend to simplify the repro because there are too many not required info :slight_smile:

I’m not sure to understand what is the problem with that PG

I think this sort of gets you there.
https://playground.babylonjs.com/#RMZC85#6

Looks like scene.meshUnderPointer does not take in to account if there is another mesh in the way.

What I did was just do a simple scene.pick at where the mouse is currently at and check to see if the hit mesh is what is currently under the cursor. There are likely better ways to do this though.

1 Like