playMaker

Author Topic: FingerGestures Actions (Beta)  (Read 20586 times)

Spk

  • Playmaker Newbie
  • *
  • Posts: 12
    • View Profile
FingerGestures Actions (Beta)
« on: April 11, 2012, 11:44:04 AM »
Hi!

I'm the author of FingerGestures, a Unity plugin that allows you to detect common input gestures. Due to popular request, I’ve recently been working with Alex on adding support for FingerGestures to PlayMaker, and now have something ready for testing!

I've attached to this post a package with the early beta version of the new FingerGesture actions. At the moment there's only two of them:
- FingerGestureDetectInput allows you to detect all the default gestures supported by FingerGestures (finger down, finger up, tap, double tap, swipe, long press, pinch, rotation...) and generate an FSM event along with output variables you can store some of the gesture data in
- FingerGesturesGetFingerInfo lets you access all the properties of a specific finger (position, delta position, touch status, touch start time, etc)

It also comes with built-in support for interacting with scene objects via gestures, which should make it quite easy to work with. For instance, you can have the tap gesture event fire only if a specific object was tapped.

I would really appreciate if some of you with access to FingerGestures could give this a try and give me some feedback here.

Thanks in advance! :)

---

UPDATE: v0.3
- Made the FingerGesturesDetectionInput stateless when it comes to handling continuous gestures such as drag, pinch and rotation.
- Added "Must Hit Object" property to the FingerGesturesDetectionInput action to require a valid object to be present under the finger(s) for events to fire
- Added support for dragging objects via the FingerGestureDragObject action. See "Playmaker Drag" sample scene in the Samples folder.
- Added "Playmaker Tap" sample in the Samples folder

UPDATE: v0.2
- Added Ignore Layer property to FingerGesturesDetectInput action to ignore colliders in specific layers when raycast for objects under the finger
- Removed left-over raycast in FingerGesturesActionHelpers.PickObject()
« Last Edit: April 25, 2012, 12:16:57 PM by Spk »

Lars Steenhoff

  • Playmaker Newbie
  • *
  • Posts: 36
    • View Profile
Re: FingerGestures Actions (Beta)
« Reply #1 on: April 12, 2012, 12:13:11 PM »
I'm gonna try this out in a bit, Thanks for the effort!

Lars Steenhoff

  • Playmaker Newbie
  • *
  • Posts: 36
    • View Profile
Re: FingerGestures Actions (Beta)
« Reply #2 on: April 12, 2012, 12:20:14 PM »
one thing I'm trying to achieve is a pinball flipper action in playmaker, I'm hoping this will help me do it.

For this I divide the screen in two halves left and right.
Then I need to detect if finger is pressed left or right screen.
now activate the according left or right flipper. ( rotate physics object )

The difficult part is that the flipper needs to stay up when a finger is pressed down and only release once the finger is up again.  ( rotate back )

If you can make an example with this kind of behavior that would be very insightful on how this works.

Thanks

Spk

  • Playmaker Newbie
  • *
  • Posts: 12
    • View Profile
Re: FingerGestures Actions (Beta)
« Reply #3 on: April 12, 2012, 03:14:35 PM »
Thanks for the suggestion Lars. I'm currently doing quite a bit of work revamping the FingerGestures documentation and samples, so it may take a little while until I get to the PlayMaker samples. In the meanwhile, I can do my best to answer your questions though.

pneill

  • Playmaker Newbie
  • *
  • Posts: 32
    • View Profile
Re: FingerGestures Actions (Beta)
« Reply #4 on: April 13, 2012, 10:53:10 PM »
Got at fair number of errors when I imported the package.

Assets/FingerGestures/Extensions/Playmaker/FingerGesturesDetectInput.cs(177,32): error CS0123: A method or delegate `HutongGames.PlayMaker.Actions.FingerGesturesDetectInput.FingerGestures_OnFingerTap(int, UnityEngine.Vector2)' parameters do not match delegate `FingerGestures.FingerTapEventHandler(int, UnityEngine.Vector2, int)' parameters

Assets/FingerGestures/Extensions/Playmaker/FingerGesturesDetectInput.cs(177,32): error CS0428: Cannot convert method group `FingerGestures_OnFingerTap' to non-delegate type `FingerGestures.FingerTapEventHandler'. Consider using parentheses to invoke the method

Assets/PlayMaker/Actions/FingerGestures/FingerGesturesDetectInput.cs(180,32): error CS0117: `FingerGestures' does not contain a definition for `OnFingerDoubleTap'

Assets/PlayMaker/Actions/FingerGestures/FingerGesturesDetectInput.cs(212,28): error CS0123: A method or delegate `HutongGames.PlayMaker.Actions.FingerGesturesDetectInput.FingerGestures_OnFingerTap(int, UnityEngine.Vector2)' parameters do not match delegate `FingerGestures.FingerTapEventHandler(int, UnityEngine.Vector2, int)' parameters

Assets/PlayMaker/Actions/FingerGestures/FingerGesturesDetectInput.cs(212,28): error CS0428: Cannot convert method group `FingerGestures_OnFingerTap' to non-delegate type `FingerGestures.FingerTapEventHandler'. Consider using parentheses to invoke the method

Assets/PlayMaker/Actions/FingerGestures/FingerGesturesDetectInput.cs(213,28): error CS0117: `FingerGestures' does not contain a definition for `OnFingerDoubleTap'

Any idea what I did wrong?


Spk

  • Playmaker Newbie
  • *
  • Posts: 12
    • View Profile
Re: FingerGestures Actions (Beta)
« Reply #5 on: April 14, 2012, 02:50:55 AM »
Yeah, you actually need the FingerGestures package too ;)


pneill

  • Playmaker Newbie
  • *
  • Posts: 32
    • View Profile
Re: FingerGestures Actions (Beta)
« Reply #6 on: April 14, 2012, 09:53:43 AM »
Yeah, you actually need the FingerGestures package too ;)

Huh.  That's curious, because I do have finger gestures and it's installed.  Perhaps I need to use a beta?  Or maybe my installation is mucked up?  What version of playmaker and finger gestures did you test with?




Spk

  • Playmaker Newbie
  • *
  • Posts: 12
    • View Profile
Re: FingerGestures Actions (Beta)
« Reply #7 on: April 14, 2012, 09:57:45 AM »
Oops, my apologies! :D
You're probably just running an older version of FingerGestures. You need to be running v2.3b. Which one are you currently using?

pneill

  • Playmaker Newbie
  • *
  • Posts: 32
    • View Profile
Re: FingerGestures Actions (Beta)
« Reply #8 on: April 14, 2012, 02:58:46 PM »
Yup,that was it.  I was using 2.3 not 2.3b.   

Note, that I do get a warning about the variable 'ray' being assigned but never used.


pneill

  • Playmaker Newbie
  • *
  • Posts: 32
    • View Profile
Re: FingerGestures Actions (Beta)
« Reply #9 on: April 15, 2012, 01:00:24 PM »
First, this is a really awesome addition.   Accessing touch events in playmaker has never been easier.

Questions/Comments
Is there a way to ignore certain objects?  I have a rather large trigger attached to an object that is in the "Ignore Raycast" layer, but the Finger Gestures Detect Input seems not to have a way to ignore objects in certain layers.  The playmaker "Screen Pick" action has a pretty good way of handling this.

Two caution events are generated

Correcting bad FingerPhase transition (FingerPhase.Ended skipped)
UnityEngine.Debug:LogWarning(Object)
Finger:Update(FingerPhase, Vector2) (at Assets/Plugins/FingerGestures/FingerGestures.cs:886)
FingerGestures:UpdateFingers() (at Assets/Plugins/FingerGestures/FingerGestures.cs:1107)
FingerGestures:Update() (at Assets/Plugins/FingerGestures/FingerGestures.cs:1044)

Assets/FingerGestures/Extensions/Playmaker/FingerGesturesActionHelpers.cs(103,17): warning CS0219: The variable `ray' is assigned but its value is never used

Spk

  • Playmaker Newbie
  • *
  • Posts: 12
    • View Profile
Re: FingerGestures Actions (Beta)
« Reply #10 on: April 17, 2012, 08:58:56 AM »
Thanks for the feedback pneil!
Adding an option for the object raycast layer should be no problem, good idea! I will add this asap.

As for the double tap vs single tap issue, it's a bit tricky because there is no perfect way to do this from the code without having bad side effects. The reason for this is explained in more detail in this forum thread.

However, you should be getting BOTH events fired, not just one. In theory, if you do a double tap gesture and have registered for both tap & double tap events,  you should be getting a "tap" event each time the finger tapped the screen, and then a final "double tap" event after two taps occurred. The gestures do not "consume" the input, so they can't prevent one another from receiving input data. Can you double check and confirm you are not getting both events fired please? If not, I might have a bug on my hands :)
« Last Edit: April 17, 2012, 09:03:52 AM by Spk »

pneill

  • Playmaker Newbie
  • *
  • Posts: 32
    • View Profile
Re: FingerGestures Actions (Beta)
« Reply #11 on: April 17, 2012, 10:07:00 PM »
Awesome news on the raycast layer!  Thanks!!

Regarding the single/double tap.  I think you got a bug here.  I made a very simple scene with just a cube in in it that changes color based upon tap event vs. double tap event - tap event changes cube to one color while double tap changes it to another.    Double tap event never gets called.   I always just get the tap event.

Spk

  • Playmaker Newbie
  • *
  • Posts: 12
    • View Profile
Re: FingerGestures Actions (Beta)
« Reply #12 on: April 18, 2012, 01:30:21 PM »
Update: version 0.2
- Added Ignore Layer property to FingerGesturesDetectInput action to ignore colliders in specific layers when raycast for objects under the finger
- Removed left-over raycast in FingerGesturesActionHelpers.PickObject()

(Download attachment updated in first post)
« Last Edit: April 18, 2012, 01:33:30 PM by Spk »

JayToronto

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: FingerGestures Actions (Beta)
« Reply #13 on: April 18, 2012, 02:39:38 PM »
This is great! Finger gestures is awesome.

Spk

  • Playmaker Newbie
  • *
  • Posts: 12
    • View Profile
Re: FingerGestures Actions (Beta)
« Reply #14 on: April 18, 2012, 03:16:31 PM »
This is great! Finger gestures is awesome.

Now, THAT is what I like to hear :D