OnPointerOverTrigger triggers when mesh hidden by others

I don’t know if it is a bug or a wanted behaviour. But the OnPointerOverTrigger is triggered even when the mesh is not visible because it is hidden by another mesh.

But I have the problem only with OnPointerOverTrigger and OnPointerOutTrigger because, with OnPickTrigger, the event is not triggered if we can’t see the mesh.
So it would be weird and not obvious to have different behaviours depending on the pick event.

I found a former topic talking about the same thing: Check Visibility PointerOver Action - Questions & Answers - HTML5 Game Devs Forum

And here is a playground to reproduce: Babylon.js Playground

Thanks, Pichou

This is an expected behavior as the hover is used to also change the cursor so you know that there is something you can click there.

To change that behavior:

See line 6-8:

scene.pointerMovePredicate = function(mesh) {
        return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled();
1 Like

Ok thanks I will use that to avoid the hover pointer mouse to show then.

But I feel like I misunderstood something:
What is the point of knowing there is something you can click there thanks to the OnPointerOverTrigger event when you actually can’t click on it using the OnPickTrigger event?

You can if you change the predicate of pointerdown:)

But the very reason with the pointerdown predicate is more restrictive is perf: we do not want to do a picking on almost all meshes when you move so the predicate restricts itself to meshes with actionmanager. The side effect is that in your case the occluder is not seen

1 Like