Stop fullscreen AdvancedDynamicTexture from intercepting clicks?

Regarding fullscreen mode the docs say: “In this mode, Babylon.GUI will cover the entire screen and will rescale to always adapt to your rendering resolution. It will also intercept clicks (including touches).”

Is this a rule, with no way around it? Is there a way to disable this? Or pass clicks through to Babylon? I want to still be able to click meshes through the fullscreen GUI.

You’re thinking it’s intercepting every click as some sort of fullscreen overlay, right? But that’s not the case. It interceps as in it won’t let the click through when you click on a GUI element. You can still normally handle your scene around the GUI elements.

Take a look: https://playground.babylonjs.com/#XCPP9Y#16026

4 Likes

OK, I believe @Regit gave you the answer but I guess I can add some details to it. English is also not my language but the explanation above would feel a bit obscure to me if I would not know at all how it works.

In fact, the advancedDynamicTexture layer in full-screen mode adds ‘a layer’ to the scene. The ADT layer, by default, always displays on top of all elements in the scene (except the 3D GUI and the post-process pipeline). However this layer is not a pointerBlocker. The layer itself does not prevent from any pointer or touch interactions in the scene (or for anything that is below in the hierarchy).

To actually block pointer/touch interactions/events below the ADT, you would first need to add containers or controls to it. In this case a button (i.e.) or a rectangle that displays above the scene object would block any potential pointer event on the object behind it. Some controls and containers are blockers by default, others are not. Check the doc on the 2D GUI to understand the default behavior of each. It is also worth mentionning here that ‘isPointerBlocker’ or ‘isReadOnly’ does actually not prevent from triggering pointer events (only animations) within the ADT itself (both in FS mode or for a mesh).

So, in clear and simply said, if there’s no 2D GUI pointerBlocker control or container in front of your interactive mesh, you can still interact with it normally. Else, if there’s a 2D GUI container or control displaying in front of the mesh, you need to check back on this control or container default property to see if it is or is not a pointerBlocker.

4 Likes

Gotcha thank you, now found that my issue is something else entirely, but occurred at the same time as adding the GUI.

1 Like