Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: KozTheBoss on April 18, 2013, 07:02:08 AM

Title: Mouse Pick detecting ground when clicking through GUI
Post by: KozTheBoss on April 18, 2013, 07:02:08 AM
so in the game im making, I use mouse pick masked to ground only to get the mouse pick position and move the player to that position

The mouse pick is as said masked to the "ground layer" only, but i am now starting to draw the GUI using GUI Textures and GUI Buttons - the problem i am having though, is that when a GUI window opens and the player clicks on it, it detects the ground BEHIND the GUI window and moves the player - I can't figure out how to fix that =( Any help? disabling the mouse pick when a window is open is not an option, as i still want the player to be able to move around by clicking on the ground, just not through the GUI

Any help appriciated!

-Fred
Title: Re: Mouse Pick detecting ground when clicking through GUI
Post by: KozTheBoss on April 19, 2013, 08:55:02 AM
Shameless Bump! this is really a gamebreaker right now, and my grad project hand-in is coming up! i need this fixed =(
Title: Re: Mouse Pick detecting ground when clicking through GUI
Post by: MurDocINC on April 20, 2013, 12:10:57 PM
My guess, you'll need a state to check if u clicking GUI before your mouse pick/move states. If GUI clicked go back to listener state, if not go to mouse pick/move.
Title: Re: Mouse Pick detecting ground when clicking through GUI
Post by: KozTheBoss on April 22, 2013, 06:06:22 AM
but how do i test if i clicked a GUI? because as far as i know, there is no way to test it since its an empty GO with a GUI texture component, i cant detect mouseover (since it has no renderer component and no mesh in the game world)
Title: Re: Mouse Pick detecting ground when clicking through GUI
Post by: doppelmonster on April 22, 2013, 07:56:18 AM
I have the same problem here with GUI Button. I didnt find a solution yet.

There is a "Touch GUI Event" but that is for mobile devices and is for GUI Texture or GUI Text (Not GUI BUtton).

So in your case you would need a similar action but for mouse pick (like Mouse GUI Event)
Title: Re: Mouse Pick detecting ground when clicking through GUI
Post by: MurDocINC on April 22, 2013, 06:19:14 PM
GUI Button has "Store Button State" to a bool variable. Make the variable global so you can access it in your check GUI state. Then use "bool any true" or "bool test" to check and send event.
Title: Re: Mouse Pick detecting ground when clicking through GUI
Post by: doppelmonster on April 23, 2013, 08:03:32 AM
Hi,
i tried "Store Button state" like you mentioned. But the "Bool Test" Event is not executed while the "Get Mouse button Down" is executed. So its not working for me. Do i miss something?
Title: Re: Mouse Pick detecting ground when clicking through GUI
Post by: doppelmonster on April 25, 2013, 03:27:58 AM
I solved my problem:

Where i have my GUI i position polys with a collider an NO meshrender component in front of the camera (parenting to the cam). Then i use the "Touch object event" to jump to an idle state in my touch manager FSM.

This works pretty well  :)
Title: Re: Mouse Pick detecting ground when clicking through GUI
Post by: d1.favero on January 09, 2017, 01:01:05 PM
necro post but this happens a lot. Something in playmaker actually can make this better or still a hack?
Title: Re: Mouse Pick detecting ground when clicking through GUI
Post by: jeanfabre on January 10, 2017, 02:08:45 AM
Hi,

 you should be using the new Unity UI system. The old system indeed has this problem.

Bye,

 Jean
Title: Re: Mouse Pick detecting ground when clicking through GUI
Post by: HedgeWizard on August 14, 2022, 05:17:14 AM
Hi.

I am having the same problem. Trying to prevent a player character from pressing the NavMesh when I press a UI button. Tried masking with a box collider to no effect.

Bests