playMaker

Author Topic: Swipe only when over GUI [Solved]  (Read 3229 times)

parallel

  • Full Member
  • ***
  • Posts: 155
Swipe only when over GUI [Solved]
« on: January 07, 2014, 02:38:16 PM »
I'm at a loss on how to solve this one. I'm using DFGUI, but I think the problem is 'universal'. How to raycast or detect in some way if ones touch is over a GUI element? as the GUI cam is a fixed orthogonal one, and the regular 'game cam' won't detect hitting that layer.

Attached is an image of my wish to only activate swipe when over specific GUI elements, swipe left-right = green layer and up-down = red layer and no swipe for purplish GUI. But when touch is over the 3d guy in the dark greenish area I don't want swipe to work, just regular touch (orbit cam), and viceversa I don't want to orbit the character when I touch the GUI.

 
« Last Edit: January 20, 2014, 11:37:58 PM by parallel »

parallel

  • Full Member
  • ***
  • Posts: 155
Re: Swipe only when over GUI
« Reply #1 on: January 19, 2014, 09:26:42 PM »
Bump...A little hint please

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Swipe only when over GUI
« Reply #2 on: January 20, 2014, 08:11:44 AM »
You need to make a combination between colliders.
Put colliders on your GUI´s and put a background collider for orbit camera.
Then in background collider check if mouse is over with mouse pick action.
If yes enable orbital movement, if not disable.
Do you have already the orbital movement? If soo is easy.
Cheers
Seb

parallel

  • Full Member
  • ***
  • Posts: 155
Re: Swipe only when over GUI
« Reply #3 on: January 20, 2014, 02:37:37 PM »
Thanks Sebastiao, I've already tried that, but since the gui is on a different ortho cam the background capsule and player is always detected. It must be a dfgui problem, as it would make sense only to detect on that camera whether touch hits GUI or not.

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Swipe only when over GUI
« Reply #4 on: January 20, 2014, 06:07:27 PM »
Humm...
Try to make a sample scene first with just colliders. And see if´s working then bring DFGUI. Just a try.
Cheers
Seb

parallel

  • Full Member
  • ***
  • Posts: 155
Re: Swipe only when over GUI
« Reply #5 on: January 20, 2014, 07:13:25 PM »
Yes, I'll strip it back down to a simple scene to mess around, as I just noticed that you said mousepick (which I must have glossed over when reading before) didn't know that would work with touch, will get right to it.

Also discovered DFGUI input manager has a property for checking collision (its GUI elements colliders are hidden) but don't know how to get a hold of the function, as it's private so 'get property' won't work.

Quote from: DFGUI forum
Simply check whether a Daikon element is being accessed with the static property dfInputManager.ControlUnderMouse

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Swipe only when over GUI
« Reply #6 on: January 20, 2014, 07:41:01 PM »
Ohhh... Damm I thouth you were developing for PC. Because I'm only in PC area.
Sorry about the troubble.
Now of course it won't work.
Forget mouse pick.
But maybe you can deal with that using some touch events.
That´s hard.
Cheers
Seb
« Last Edit: January 20, 2014, 08:02:44 PM by Sebastião »

parallel

  • Full Member
  • ***
  • Posts: 155
Re: Swipe only when over GUI [Solved]
« Reply #7 on: January 20, 2014, 11:37:34 PM »
Got it to work with mousepick and some tagging! so thanks for the tip Seb, it does work for both mouse and touch.

I saw you asked if I could recommend DFGUI. I haven't had experience with other GUI packages but I'm really digging its easy use and support. And from the outside it looks a much better integrated solution than it's competitors imo. It's still a new act and has a few kid bugs to iron out, but it's coming along with style and constant new features, so yes I'd recommend it.

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Swipe only when over GUI [Solved]
« Reply #8 on: January 21, 2014, 03:20:19 AM »
Glad you did that.
DFGUI seems a good system, I´m looking for it.
Cheers
Seb