playMaker

Author Topic: Mouse Pick detecting ground when clicking through GUI  (Read 4451 times)

KozTheBoss

  • Full Member
  • ***
  • Posts: 150
  • You dont fail unless you give up trying to succeed
    • View Profile
    • Pixel Life - portfolio
Mouse Pick detecting ground when clicking through GUI
« 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
Remember, you don't fail unless you give up trying to succeed!

KozTheBoss

  • Full Member
  • ***
  • Posts: 150
  • You dont fail unless you give up trying to succeed
    • View Profile
    • Pixel Life - portfolio
Re: Mouse Pick detecting ground when clicking through GUI
« Reply #1 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 =(
Remember, you don't fail unless you give up trying to succeed!

MurDocINC

  • Playmaker Newbie
  • *
  • Posts: 8
    • View Profile
Re: Mouse Pick detecting ground when clicking through GUI
« Reply #2 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.

KozTheBoss

  • Full Member
  • ***
  • Posts: 150
  • You dont fail unless you give up trying to succeed
    • View Profile
    • Pixel Life - portfolio
Re: Mouse Pick detecting ground when clicking through GUI
« Reply #3 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)
Remember, you don't fail unless you give up trying to succeed!

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • View Profile
    • Grinder Games
Re: Mouse Pick detecting ground when clicking through GUI
« Reply #4 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)

MurDocINC

  • Playmaker Newbie
  • *
  • Posts: 8
    • View Profile
Re: Mouse Pick detecting ground when clicking through GUI
« Reply #5 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.

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • View Profile
    • Grinder Games
Re: Mouse Pick detecting ground when clicking through GUI
« Reply #6 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?

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • View Profile
    • Grinder Games
Re: Mouse Pick detecting ground when clicking through GUI
« Reply #7 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  :)

d1.favero

  • Playmaker Newbie
  • *
  • Posts: 1
    • View Profile
Re: Mouse Pick detecting ground when clicking through GUI
« Reply #8 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?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15444
  • Official Playmaker Support
    • View Profile
Re: Mouse Pick detecting ground when clicking through GUI
« Reply #9 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