Clicking through world UI


We want to click through some controls in our worldspace UI. To do this, we need to manually do a scene.multiPick() and check if it’s UI. This all works fine, but for this to really work, we need to set the isHitTestVisible property on multiple controls including the root control. This currently causes issues with the onPointerOutObservable not being called properly.

This playground might explain the situation more clearly: Babylon.js Playground
When you start hovering over the button, it becomes red. When you hover exit, it should become black.

It seems to me that when nothing has been hit in the _doPicking, it doesn’t call the onPointerOutObservable of the last control.
There’s already some code that should handle this case: Babylon.js/packages/dev/gui/src/2D/advancedDynamicTexture.ts at master · BabylonJS/Babylon.js · GitHub
but it’s being cancelled out by the target === this check in Babylon.js/packages/dev/gui/src/2D/controls/control.ts at master · BabylonJS/Babylon.js · GitHub

When I add true as the third argument to the _onPointerOut call, it works as I’d expect.

1 Like

that’s most certainly feels like a b… b… issue! :wink:

I’m assigning myself, will follow up on this one.

I was trying to understand the reasoning behind the check, and decided to remove it:

Remove check for pointer out by RaananW · Pull Request #15255 · BabylonJS/Babylon.js (

Would be great if you check your scenario using the PR snapshot (once build is done).

That indeed seems to resolve the issue in the playground

1 Like