Ground intercepting button click

When i click on button, the ground takes the click:

I want buttons to be clicked.

Adding @carolhmj

It’s taking the click because you’re hooking the event listener directly to the canvas pointerdown, it doesn’t go through Babylon at all…

If you want the canvas events to be processed by Babylon, hook the listener to a scene pointer observable, like pointer pick: groundbutton | Babylon.js Playground (babylonjs.com)

And you can set isPointerBlock true on the GUI controls, so clicking on a GUI element won’t propagate the click to the Babylon scene, which is what I assume you want.

2 Likes

Thanks, is there a way i can set a background image to to scrollViewer

You can put any GUI element inside it, so you could put an image: groundbutton | Babylon.js Playground (babylonjs.com), you have to set its zIndex so it renders on the bottom of the buttons.

1 Like