Search Unity

[RELEASED] FingerGestures - Robust input gestures at your fingertips!

Discussion in 'Assets and Asset Store' started by Bugfoot, Jul 8, 2011.

  1. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    The TBInputManager has a "raycast camera" property that you could change dynamically depending on which camera is the active one. The system would then use that camera to do the raycasts to pick scene objects from that particular viewpoint. Have you tried this?
     
  2. Krodil

    Krodil

    Joined:
    Jun 30, 2010
    Posts:
    141
    I also think this could be a viable solution. Havent had luck with it yet.
    Exchanging what is the camera should be simple enough. But how do I have a panning plane when I look with a 45 degree rotated cam.
    Maybe I could change the pos. of the cam, but that would still require to change parts of the TBINputMGR..

    On top of this I have some difficulties disabling scripts attached to objects and cams. E.g. I want to turn of the PinchRotationSample when I am in the tilted cam. Cant seem to disable per script..
    Any hints?

    EDIT: I think it might be that some of the scripts are located in a folder where I cant move them from. Thus compilation order kicks in. PinchRotationSample is not accessible for me eventhough my communication should be correct. Please look here:http://forum.unity3d.com/threads/146612-How-to-disable-c-script-on-Go-from-a-javascript
     
    Last edited: Aug 7, 2012
  3. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
  4. Karsnen_2

    Karsnen_2

    Joined:
    Nov 28, 2011
    Posts:
    89
    I am looking to create a force in accordance to direction of the swipe of the player. So, I have to find the direction of swipe and apply it as Vector2(say) force on the game. Is it possible through your package? From the about section of your package, it says only the up/down/right/left drag.

    Please let me know.

    Thank you.
     
  5. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hello Karsnen,

    In the current version (2.3b), the swipe gesture only offers 4 directions. You'd have to use the drag gesture instead. However, I'm a few hours away from releasing a beta of the 2.4 update, in which I've exposed the unconstrained swipe motion/direction vector (in addition to adding diagonals as part of the constrained directions enum).

    I hope that answered your question :)
     
  6. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    I've just released a beta version of the upcoming v2.4 update. It's available for download on the fingergestures forum here (members with registered copies only).

    Highlights
    - Each finger now tracks the top-most scene object under it (Finger.Collider, Finger.OnColliderChanged)
    - Added toolbox scripts for object-based pinch rotation gestures (TBPinch, TBTwist)
    - Added panning camera controller (TBPan - good for topdown/side views)
    - Added a drag-based first-persona camera controller (TBDragView TBLookAtTap - think "google street view")
    - Revamped swipe gesture (support for diagonals, exposed swipe motion vector)
    - Made drag and swipe gestures more responsive
    - Added rotation/twist gesture emulation on desktop (Ctrl + MouseWheel by default)
    - Included PlayMaker actions for FingerGestures (located in Assets\FingerGestures\Extensions\PlayerMaker)
     
  7. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    @SPK thanks for the great advancements in FingerGestures. I'm having issue with the OnFingerMoveEnd being just a bit to slow to catch a OnFingerUp call when releasing a finger quickly during an OnFingerMove gesture. Is there a way to tune the performance of the OnFingerMoveEnd to be more sensitive to catching the FingerUp event that SHOULD come after an OnFingerMoveEnd if I elect to have it do so?

    Is there a float-based tolerance for how long the OnFingerMoveEnd call takes until it will allow for a FingerUp to be recognized?

    In addition, does anyone know of a means, with the FingerGestures API, to find out if there are NO (zero) fingers down at the time?

    Also, how does "FingerGestures.Touches" actually work? how do you implement it to see how many touches are active?
     
    Last edited: Aug 14, 2012
  8. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    @3Duaun: I have to dig a bit into the code to answer your question about OnFingerMove, so i'll try to get back to you today on this.
    But when it comes to your second question, you can get the number of active touches via FingerGestures.Touches.Count. The FingerGestures.Touches collection is a list of all the fingers currently touching the screen.
     
  9. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Alright guys, I'm off for 10 days - See you on the 26th of August :)
     
  10. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    @SPK thanks for the help, the touches.count is just what I needed to work around the issue with the fingerMoveEnd not catching a fingerUp event as an option.

    Have a great vacation!
     
  11. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    @SPK
    thanks for the reply. The FingerGestures.Touches helped, but showed me that onFingerMoveEnd still registers a touchCount of "1" on releasing the onFingerMove on various iOS devices, when there are ZERO fingers on the device at that time(thus the OnFingerMoveEnd). Shouldn't this be a count of zero 0, if the Finger is up on a FingerMoveEnd?

    I've gotten around the issue, by setting up a coRoutine linked to an enum that does a specific looping touches.Count check, and triggers the method that is waiting for a Touch Count of zero when an OnFingerMoveEnd is called, so all works for me now, but having the OnFingerMoveEnd, that ends with a FingerUp event, it would be helpful if it actually called the OnFingerUp event too, for other users that might come upon this issue and not want to code a workaround for this, as i have.

    EDIT: after a few more tests, I've found that depending on the speed of the system I'm testing FingerGestures on there is up to a 4-5 frame lag until the Touches.Count is equal to Zero, after an OnFingerMove is triggered, and releasing the finger at the end of the move. IMO, this should be an instant change/check done, and not lag a small number of frames until it updates.
     
    Last edited: Aug 16, 2012
  12. Wisit-Nik

    Wisit-Nik

    Joined:
    Jul 28, 2012
    Posts:
    12
    Anyone know how to clear subscribe functions from the event?
    I have a problem when try to load another scene but event still remember old subscribes.
     
  13. jako

    jako

    Joined:
    Aug 21, 2012
    Posts:
    5
    Custom gestures didn't landed yet, does anyone have some hints to implement them myself?
     
  14. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    So I have OnFingerDragMove trigger physics stuff where I'm applying forces. Does OnFingerDragMove event trigger on Update or FixedUpdate? If on Update, I assume I should be multiplying the forces by timedelta?
     
    Last edited: Aug 21, 2012
  15. DreamEnder

    DreamEnder

    Joined:
    Apr 12, 2011
    Posts:
    191
    I sometimes find that swipe events are not getting triggered on the iPhone every so often even though the game is running at 30 fps constant. Is there a setting to make input more accurate?
     
  16. newborne

    newborne

    Joined:
    Jul 16, 2012
    Posts:
    31
    I purchased this and i am happy with it! I am using TBDragOrbit script and i was wondering is it possible to have pan and zoom separate from each other? What i mean is, when i started pan i do not want zoom to be triggered and vice versa. is it possible to do it quickly and easily?

    Thanks!
     
  17. AngryOrange

    AngryOrange

    Joined:
    Jan 30, 2012
    Posts:
    103
    Hi I just bought FingerGestures and all I need is to rotate something making a circle shape on it.. In my game I need to cause the rotation of the wheel using gestures. Can you guy's help me with this ?
     
  18. Krodil

    Krodil

    Joined:
    Jun 30, 2010
    Posts:
    141
    try to explain it a bit more. What wheel, what circle shape? what did you do to solve it. etc..
     
  19. AngryOrange

    AngryOrange

    Joined:
    Jan 30, 2012
    Posts:
    103
    Ok. I have a wheel on a screen , when user is rotating this wheel something is happening. To rotate this wheel user have to make a circle gesture on this wheel.
    This is exactly what I need :
    http://www.youtube.com/watch?v=eUnc2ghaSXA look at 2:26.
    Thank You in advance.
     
  20. Krodil

    Krodil

    Joined:
    Jun 30, 2010
    Posts:
    141
    try to add a TBrotateTwist onto your wheel. Alternatively, try to change the 'target' in the pinchRotationSample.
    I need more info for more elaborate help :)
     
  21. AngryOrange

    AngryOrange

    Joined:
    Jan 30, 2012
    Posts:
    103
    hmmm I can not even PinchRotation example make to work. :(
    Tap example working just fine.
     
  22. AngryOrange

    AngryOrange

    Joined:
    Jan 30, 2012
    Posts:
    103
    Ok all examples are working just fine. But how to rotate an object drawing something like circle shape on this object using one finger ? Is it hard to implement ?

    http://www.youtube.com/watch?v=eUnc2ghaSXA look at 2:26.
     
  23. hvilela

    hvilela

    Joined:
    Dec 6, 2010
    Posts:
    24
    There's any ready to use "image manipulation" example using FingerGestures as the one find with Easy Touch?
     
  24. dev_peter

    dev_peter

    Joined:
    Aug 9, 2012
    Posts:
    38
    can I define a region where fingergestures is active? So that its not using the whole ipad screen for a drag gesture?
     
  25. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hey guys - I've been back for a few days, but haven't gotten around to answering support posts in this thread, so sorry about that! I will go through your questions later today.

    In other notes, I'm very busy working on the next big release, v3.0, which is a major revamp of FingerGestures which should make a lot of things much more smooth and easy, such as setup interaction with scene objects, in addition to big improvements in gestures responsiveness. I scrapped the v2.4 update to go straight for this major release. As part of the effort is a complete rewrite of the documentation and updated samples which should considerably lower the initial learning curve. I'm planning on releasing a beta version of it in the next few days, as it's getting close to feature complete now.
     
  26. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    You could specify a global touch filter, as demonstrated in this forum thread.
     
  27. dev_peter

    dev_peter

    Joined:
    Aug 9, 2012
    Posts:
    38
    Thanks for the quick reply! It's working fine!
     
  28. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    Hi,

    I'm really impressed with this kit, however I'm planning to implement a game where I need the Tilt behavious, I mean when I tilt my phone to the right the player will move a little to the right, and if I tilt my phone to the left the player will tilt a little to the left (with no fingure touching only tilting the phone), are this supported by FingureGestures?
     
  29. stevej_old

    stevej_old

    Joined:
    Mar 31, 2009
    Posts:
    16
    Quick question (that may be a little dumb).

    I need to add this functionality to my project, but it will not be centered around objects within the game world. For example, I want the player to be able to "Swipe Left" at any point on the screen, "Press and Hold" at any point on the screen, etc.

    Is that possible? I ask because the demo always seems to be centered around a GameObject (e.g. spheres). In my case, the GameObject that I will need to "attach" to will essentially be the view or screen itself.
     
  30. AngryOrange

    AngryOrange

    Joined:
    Jan 30, 2012
    Posts:
    103
    Hi
    @ dev_peter can you tell me how you did this. In my game I want to make a swipe gesture only on a Player, I want to make tap, or long Tap ONLY on specific objects.
    I don't know haw to write this kind of statements ... can you help me ?
     
  31. unormal

    unormal

    Joined:
    Jan 10, 2012
    Posts:
    65
    I'd actually like to know this too. Currently in each scene I have to do something like:

    void Unload()
    {
    FingerGestures.OnDragMove -= FingerGestures_OnDragMove;
    FingerGestures.OnDragEnd -= FingerGestures_OnDragEnd;
    FingerGestures.OnDragBegin -= FingerGestures_OnDragBegin;
    FingerGestures.OnTap -= FingerGestures_OnTap;
    }

    In order to have the current scene's handler's removed.

    It's not a game breaker, but It'd be nice if there was some way to easily clear all registered events, to make scene switches clean.
     
  32. badawe

    badawe

    Joined:
    Jan 17, 2011
    Posts:
    297
    Hey @SPK thanks for the amazing plugin! Great addition to our team!

    Some questions:
    - I Need to detect diagonal movements on swipe? Can you help me with the best way to do that? Like DiagonalUpperLeft, DiagonalUpperRight, DiagonalLowerLeft, DiagonalLowerRight.
     
  33. badawe

    badawe

    Joined:
    Jan 17, 2011
    Posts:
    297
    Humm, one more thing, i need to detect 2 swipes at same time, to different directions, this is possible?
     
  34. hvilela

    hvilela

    Joined:
    Dec 6, 2010
    Posts:
    24
    Any updates in the Flash support?
     
  35. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    No sorry, that kind of gesture isn't supported at the moment. You should be able to get that pretty easily using Unity's builtin support for the accelerometer though.
     
  36. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Yes it's supported (both in the v2.X and 3.X). By default you subscribe to global events that are not tied to an individual object in the scene. In 3.X you can use a FingerGesturesListener to receive event messages regardless of which object is being interacted with.
     
  37. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Please check out the new beta version of FingerGestures (3.0.beta0) available on the official forums. It takes care of all of that stuff for you now :)
     
  38. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Diagonal swipe directions are supported in version 2.4 beta and up.

    - in v2.4.beta0, you can access it via the swipe event handler's "direction" parameter
    Code (csharp):
    1. void FingerGestures_OnFingerSwipe( int fingerIndex, Vector2 startPos, FingerGestures.SwipeDirection direction, float velocity )
    2.     {
    3.         if( direction == FingerGestures.SwipeDirection.UpperLeftDiagonal )
    4.         {
    5.             // your code here
    6.         }
    7.     }
    - in v3.0.beta0, you can access it via e.Direction
    Code (csharp):
    1.  
    2. void OnFingerSwipe( FingerGestures.Events.Swipe e )
    3. {
    4.     if( e.Direction == FingerGestures.SwipeDirection.UpperLeftDiagonal )
    5.     {
    6.         // your code here
    7.     }
    8. }
    9.  
    Yes, use the OnFingerSwipe event.
     
    Last edited: Sep 30, 2012
  39. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Quick announcement: I've just released the first beta version of FingerGestures v3.0.

    This one took quite a bit of work and time to get right, but I’m finally happy enough with it to release a first beta version of it that registered users can download right now from the Beta Releases section of the forum.

    This is quite a major rewrite of FingerGestures that should make it considerably easier to understand, use and integrate in your projects. Here’s a list of some of the major changes:

    - Switched to Unity’s SendMessage() approach for gesture event notifications (deprecating .NET events)
    - Gesture event data now include a reference to the top-most scene object being interacted with
    - Scene objects equipped with a collider can now automatically receive gesture event notifications (via SendMessage)
    - Improved overall gestures responsiveness
    - Automatic detection of Unity Remote
    - Twist gesture emulation on desktop using CTRL + Mousewheel (by default)
    - New priority system for events allows an event listener to consume/swallow specific events before they reach the next listeners
    - Option to adjust pixel distances to account for retina displays on iOS
    - Many minor bug fixes and improvements

    I’m planning on releasing this version on the Asset Store within the next two weeks after it has gone through enough testing and the documentation has been properly updated to reflect the massive changes.
     
  40. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    I'm having trouble figuring out how to set the Duration property for a LongPress gesture. The doco doesn't seem to be up to date on it? Are you able to provide a quick example?
     
  41. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    You can change it on the default Long Press Gesture prefab included in the package (there's a Duration property on it). Otherwise, you can access the long press gesture recognizer at runtime via FinerGestures.Defaults.LongPress (or FingerGestures.Defaults.Fingers.LongPress for the per-finger long press gesture recognizer).
     
  42. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    OK - that's what I've been doing (using FingerGestures.Defaults.LongPress.Duration), but it doesn't seem to have any effect. I'll experiment some more to make sure I'm not doing something stupid.
     
  43. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    What LongPress event are you using? OnFingerLongPress or OnLongPress? Also, what version of FingerGestures are you using?
     
  44. AngryOrange

    AngryOrange

    Joined:
    Jan 30, 2012
    Posts:
    103
    Can you help me with drawing something like TrailRenderer while user is making swipe gesture ? Something like slash line in Fruits Ninjia....
    I'am using FingerGestures of course :)
     
  45. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Hi Spk, just a suggestion - I would like to see an example of "Virtual Controls" or "touchscreen joystick" or a feature to easily implement that. Thanks :)
     
  46. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    Is there something like OnFingerSwipe but for any direction (vector2)?

    edit: made my own solution
     
    Last edited: Oct 16, 2012
  47. S0ULART

    S0ULART

    Joined:
    Jun 14, 2011
    Posts:
    131
    Hello,

    did the custom gesture recognizer been added yet?
    If so, how does it work?
     
  48. giyomu

    giyomu

    Joined:
    Oct 6, 2008
    Posts:
    1,094
    look like nice improvement..I am just curious of the reason behind the switch of sendMessage() over .Net events ..?
     
  49. MibZ

    MibZ

    Joined:
    Sep 4, 2012
    Posts:
    11
    I'm trying to access the deltas of a touch, does the fingerIndex parameter of FingerGestures correlate to the same touch in Unity's Input.touches list?
     
  50. Gorgor

    Gorgor

    Joined:
    Apr 28, 2012
    Posts:
    51
    Hi,
    I'm using TBInputManager with TBComponents to react on various events on certain objects. It all works fine, but the TBDrag. TBInputManager in conjunction with TBDrag has built-in drag move. Why? It seems inappropriate. It is unexpected. It is hidden. It is NOT the responsibility of TBInputManager to do so. I do not want the object to be moved by the drag event - I just want to rotate it.. or whatever.
    I suggest to remove this functionality from TBInputManager in next big version (for the compatibility reasons, otherwise I'd remove it immediately:)) and put it in separate script one could attach to the GO if he wants to do so. It would also help to be TBInputManager so much understandable for newcomers - DragPlaneCollider on TBInputManager? wtf?.. but eventually it is all about one class = one responsibility.

    Otherwise I must say, great work and thanks for the plugin!