playMaker

Author Topic: Swipe diagonal and swipe angle  (Read 8166 times)

Kahls

  • Playmaker Newbie
  • *
  • Posts: 3
Swipe diagonal and swipe angle
« on: March 09, 2013, 03:32:26 PM »
Is there a way to detect in playmaker the swipe angle? and can playmaker detect diagonal swipes?

Sjones

  • Full Member
  • ***
  • Posts: 203
Re: Swipe diagonal and swipe angle
« Reply #1 on: March 09, 2013, 03:59:17 PM »
playmaker can not detect any gestures on its own

this would be done with the features it does have such as finger tracking (touch info) and the value returned from this used in calculations to find such things as swipe and angle.

this is because unity itself doesn't have any gesture control built in.

you may want to look at the asset store there is a gesture plug-in, dont know anything about it apart from it exists.

Kahls

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Swipe diagonal and swipe angle
« Reply #2 on: March 09, 2013, 04:03:04 PM »
Uhm I've bought the last version of playmaker and it detects swipes. There are device action like swipe and touch events. . .but swipe is detected only if is "straight". Already looked at asset store and I don't want to spend another 40$ to buy a touch event plugin that will ad only diagonal swipe to what playmaker can already do. . .

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: Swipe diagonal and swipe angle
« Reply #3 on: March 09, 2013, 04:19:28 PM »
it's often enough to define swipes as delta touch conditions. Here's a simplistic example:

[STATE1]
Get touch [touch event begins] (go to state2 on touch)

[STATE2]
get touch info (not every frame, save position to "start")
get touch info (every frame, save position to "current")
vector2 operator (current - start = deltaTouch)
touch event [ended] (go to state 3)

[STATE3]
normalize vector2
get vector2 xy
...then do a float compare split the vector2 direction into up, up right, right etc based on that. Alternatively you could also turn the vector2 direction into degrees and then compare those to your individual events. I just happened to have forgotten how to do that. Sinus is probably always a good approach I guess.
Best,
Sven

Kahls

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Swipe diagonal and swipe angle
« Reply #4 on: March 09, 2013, 04:21:22 PM »
Thanks will give it a shot!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Swipe diagonal and swipe angle
« Reply #5 on: March 25, 2013, 01:21:04 AM »
Hi,

 You could also use a gesture library such as Input.touches. I ported to playmaker with a full set of custom actions and global events.

https://hutonggames.fogbugz.com/default.asp?W961

Bye,

 Jean