lihis Posted October 10, 2017 Share Posted October 10, 2017 Hello, I have a mesh that is clickable and i would like to prevent it being clicked if there is a GUI element in front of it. Playground: http://playground.babylonjs.com/#84Q5FX In this example i made the GUI clickable as well, but i would like the GUI to stop mesh from being clicked even if there wasn't click function assigned to it. Is this possible? I can almost do this with my own input handler, but it only works like 90% of the time. And it's a bit funky involving global cooldown on clicks. It also requires me assigning an empty click function to the GUI. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted October 10, 2017 Share Posted October 10, 2017 This is at application level, but at the point where the GUI is created, could you not just make the ground unpickable? http://playground.babylonjs.com/#84Q5FX#1 I assume that since you want the mesh still pickable, that the GUI is not always there. When GUI goes away, just reset to pickable once more. Action was never unregistered, so should resume working. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 10, 2017 Share Posted October 10, 2017 Just use a button http://playground.babylonjs.com/#84Q5FX#2 Quote Link to comment Share on other sites More sharing options...
lihis Posted October 10, 2017 Author Share Posted October 10, 2017 @JCPalmer Yeah that's a possibility if you don't want the mesh clickable while the GUI is there, but i think i do want it still clickable while the GUI is there, just not where the GUI is. @Deltakosh Hmm ok that's something i could do i suppose. Feels a bit strange to make a background element from GUI.Button instead of rectangle though. And i'd have to disable the animations from the button. But i guess that's decent hackaroo. Quote Link to comment Share on other sites More sharing options...
lihis Posted October 11, 2017 Author Share Posted October 11, 2017 Ok so i happened to encounter a wild @Wingnut out and about and he actually had a great solution. No need to use buttons or anything crazy like that, instead there is a isPointerBlocker property that works just fine on GUI.Rectangle. http://playground.babylonjs.com/#84Q5FX#3 So big ups to our nutman for this tip! adam, Wingnut and GameMonetize 3 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 11, 2017 Share Posted October 11, 2017 Hey, thx Lihis! Good to hear you are rolling again. Something will break, or it will make your dog sick, or something. I'm not responsible for damages. adam 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.