playMaker

Author Topic: [SOLVED]swipe gesture on ugui elements only?  (Read 4436 times)

peaks

  • Playmaker Newbie
  • *
  • Posts: 27
[SOLVED]swipe gesture on ugui elements only?
« on: January 22, 2017, 06:53:32 AM »
Hey folks!

I'm trying to figure out this touch mechanic:

I have a simple ugui panel which I would like to use as an "input-area". My player should be able to trigger an event, if he swipes with 1 finger on this ugui panel only.

additionally, it would only trigger the event if you swipe a specific direction - something like: if you swipe to the left and the swipe started at the ugui panel, THEN trigger the event.

Does playmaker provide me such a setup or do I need an additional asset package from the store?

« Last Edit: January 26, 2017, 04:38:29 AM by peaks »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: swipe gesture on ugui elements only?
« Reply #1 on: January 23, 2017, 01:12:18 AM »
Hi,

 you can do this with the uGui package on the Ecosystem. It supports Unity UI drag and drop fully. and so your panel would be a draggable panel, that's one way to do this, else by using simple touch interactions you can create a feature that achieve the same result.

 Bye,

 Jean

peaks

  • Playmaker Newbie
  • *
  • Posts: 27
Re: swipe gesture on ugui elements only?
« Reply #2 on: January 23, 2017, 11:08:22 AM »
Hey jean! thanks for your answer!

I forgot to mention, I'm developing a game for win 10 with a touchscreen, unfortunately the touch actions won't work here, right?

anyway, the ugui package works like a charm, i've been using it for all my other buttons. Just for clarification - swipe means "click (hold) and drag", right?

I've put the "playmaker ugui drag events proxy" onto my ui panel and set up the 3 global event transisitons inside my panel fsm. But there seems to be an issue with my setup: at the "playmaker ugui drag events proxy" script in the inspector, under all 3 possible events I get the red error "missing event". But somehow the actions/events are working - I get a response with all of them.

I'm also struggling with the swipe to specific direction part. If set up "get last pointer data info / Delta to check a vector 2 variable, which gives me a hint in wich direction I swiped, but how can i move on from there?
« Last Edit: January 23, 2017, 11:11:21 AM by peaks »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: swipe gesture on ugui elements only?
« Reply #3 on: January 24, 2017, 01:01:13 AM »
Hi,

 I think they would work just fine, do you experience any trouble with this on that platform?

swipe: yes, click/hold and drag quickly, like you swipe from your mobile home screen pages.

Can you make screenshots? basically you set to none all events you don't want to use, maybe that's the issue here.

Bye,

 Jean

peaks

  • Playmaker Newbie
  • *
  • Posts: 27
Re: swipe gesture on ugui elements only?
« Reply #4 on: January 24, 2017, 08:11:21 AM »
Hi!
you'll find my panel setup attached as a screenshot. state 2 (on begin drag) holds 1 action - "get last pointer data info", the other states are empty right now / just for testing purpose.

As you can see, the inspector gives me those 3 red warnings, but the states & actions inside my fsm are working.

One little offtopic (screenshot 2 - button):
I also created a button for rotating a gameobject using unity's event trigger to create a rotation action while the button is pressed. Is it a good solution to have 2 send events (pointer up & pointer down) and only on "pointer_down / state 2"  is an action inside, state 1 and state 4 are completly empy, but in my case needed to stop the rotation. Can I make this setup or do I run into some issues because of that 2 empty states?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: swipe gesture on ugui elements only?
« Reply #5 on: January 26, 2017, 01:50:56 AM »
Hi,

 yes, simply set them to none, by default the component will expect all events to be implemented, simply opt out of the one you don't need.

empty states are fine.

 Bye,

 Jean

peaks

  • Playmaker Newbie
  • *
  • Posts: 27
Re: swipe gesture on ugui elements only?
« Reply #6 on: January 26, 2017, 03:32:51 AM »
ok perfect! thank you! ;D

peaks

  • Playmaker Newbie
  • *
  • Posts: 27
Re: swipe gesture on ugui elements only?
« Reply #7 on: January 26, 2017, 04:38:01 AM »
and trigger events while swiping a specific direction works aswell now \o/ using swipe gesture event.