Playmaker Forum
PlayMaker Updates & Downloads => Share New Actions => Topic started by: Spk on April 11, 2012, 02:44:04 PM
-
Hi!
I'm the author of FingerGestures (http://fingergestures.fatalfrog.com), 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()
-
I'm gonna try this out in a bit, Thanks for the effort!
-
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
-
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.
-
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?
-
Yeah, you actually need the FingerGestures (http://fingergestures.fatalfrog.com) package too ;)
-
Yeah, you actually need the FingerGestures (http://fingergestures.fatalfrog.com) 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?
(http://www.humblebeard.com/projectView.png)
-
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?
-
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.
-
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
-
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 (http://forum.fatalfrog.com/index.php?topic=20.0).
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 :)
-
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.
-
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)
-
This is great! Finger gestures is awesome.
-
This is great! Finger gestures is awesome.
Now, THAT is what I like to hear :D
-
Any chance you had the opportunity to look at that "tap event" vs. "double tap event" issue I mentioned. It seems that any gesture input detector that look for either a tap or double tap event never has the double tap event called.
-
No sorry, I haven't had time to look into this yet. It's on the todo list though :)
-
Just tried out the beta package and this is exactly what I am looking for/need. I'll play with the beta version more this week and post further comments on my experience.
Please keep up the development/integration with Playmaker.
-
Thx for the update.... :)
-
Any chance you had the time to look at that tap event vs. double tap event issue I reported above yet?
-
I've just posted an updated package (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
-
This finger gestures package is outstanding. The only issue I have come across is that I cannot seem to get the Pinch or Rotation Gestures to fire an event while I'm in the unity editor. When I create an Android build and do the Pinch or Rotation gesture, the event seems to fire like expected. This could be weirdness with Unity remote, but the other events(Swipe, Tap, DoubleTap and Drag) seem to work in both the editor and android build equally fine. BTW, I'm using an Galaxy Tab.
-
Ran into a little problem. Is there a way to attach Drag Object to the camera? I did this, but the camera won't move. I'm using "Use Owner, None, and ON" settings inside the action. FSM is directly attached to the camera (ortho).
-
Hm im afraid that wont work, as the drag script uses the camera to determine the amount of motion to apply... it'd be like a dog chasing his tail :)
Your best bet is to forgo the DragObject action and use the DetectInput one directly, with the drag move event and output drag delta vector setup, and use that delta value to translate the camera directly.
-
Cool, will do. Thanks for these awesome scripts! :D
-
Just bought finger gestures ^^ It works along with the GUI correct?
-
Seem to be having some issue with the rotation gesture. This very well could be a user error, so an updated package with a rotation example would be much appreciated ;D
FWIW, what I'm seeing is that in the detect input action, if no event is selected, that rotation value variables are not populated. This makes it challenging to live rotate an object without requiring a state change.
In addition, it seems like only the begin rotation event is fired. The rotation move and rotation end events don't seem to ever get fired.
Any guidance would be appreciated. Thanks!
-
Hi neil, i'll take a look at that rotation issue tomorrow and get back to you.
-
Hello.
I'm starting to use the Swipe set of gestures. I wanted to use the velocity param, but was getting a '0' value out of it.
Looking at the code (FingerGesturesDetectInput.cs), and the method FingerGestures_OnFingerSwipe, i can see the velocity being passed into the method, but no setting of the storeSwipeVelocity var. I've simply added:
storeSwipeVelocity.Value = velocity;
above the switch statement, and all seems well now.
Peace
jos
-
I got a bug report:
Finger Gestures Get Finger Info is only called OnEnter. So even if the user selected "every frame" it's only called once. You should have that every frame boolean check in OnUpdate.
-
Thanks for the bug reports, I'll include fixes in the upcoming 2.4 update (should be out as beta tomorrow).
-
Is there documentation somewhere on how to use the dragCamera action?
-
Hi
I was trying to check if a finger is already pressed and moves onto another action, so that it starts also how could I achieve this?
I mean like tap on object A and go over with still pressed finger to object B thats beneath object A.
-
Hi all i'm excited to use Finger Gestures with Unity. I have attached this to a couple game objects and it performs as stated. But my problem now is, I want to be able to pick an object on the screen and store the game object but am having trouble with this. Is there any way to do something like "mouse pick" with this?
Thanks in advance!
-
Hi,
I made an action just for this few days ago:
http://hutonggames.com/playmakerforum/index.php?topic=2921.0
basically you use this action whenever you want to pick.
bye,
Jean
-
Thanks jeanfabre I actually found your script yesterday and was going to try it out the problem is that I can not get a touch event to happen in the screen space, I am only able to get it working on object when a FSM and Finger Gesture event directly on it. My problem is I have a plane with a bunch of child objects with colliers in the scene and I want to be able to touch one of the colliers and get the object that I touched. So if I can get a position on the screen where I touched your raycast script would come in handy.
Thanks,
Jason
-
Hi,
Would that solve your problem?
http://hutonggames.com/playmakerforum/index.php?topic=2921.0
bye,
Jean
-
Quick questions. Will I be able to have a state that is capable of firting three different transitions depending if the player did a tap, hold or pinch action? Will Finger Gestures be able to distinguish the three different (and yet, some what similar) actions on the same state, or will I have to make a more elaborated FSM to make that work?
-
Hi,
yes, states can host several transition, and it's up to the first action in that state to fire what ever transition event. as for fingergesture, what is the gesture you expect to fire in different forms?
bye,
Jean
-
Hi there, I've just started working with Playmaker and FingerGestures. I'm attempting to send and event on double tap, but I can't find a 'DoubleTap' action or an option for double taps in the 'Tap Event' action. Am I looking in the wrong place or has Double Tap been removed? I see there are a lot of posts earlier in this thread mentioning problems with double tap...
-
is there any new update?
-
I'm trying to make a picturebook app for iOS. I recently got FingerGestures hoping it would make it possible to swipe between pages (scenes) but I don't know how, and can't find any tutorials or documentation on that. Is that even possible to swipe between scenes?