Search Unity

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

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

  1. nm8shun

    nm8shun

    Joined:
    Jul 14, 2007
    Posts:
    476
    Bought this a long time ago when it was on sale knowing that some day I'd have a project that I'd need it. And now it's here...

    The problem I'm having is this: I need to move a vertical slider that doesn't sit at Z=0. So the slider should move up and down in Y (with a top and lower limit), not move at all in X, but not be at Z=0.

    I've tried tearing apart the demo scenes, and can drag the slider (in X and Y), but need help on the constraints. Any suggestions on how to make this happen?
     
  2. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Hey there,

    great tool! Like to work with it, but could you tell, when exactly the Online-Documentation will be online again?
     
  3. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Thinking of buying this. As a `complete user input system`... is there any support for iOs accelerometer type of stuff, ie to implement `tilt` controls or to understand position in space or what angle the device is held at etc?
     
  4. nm8shun

    nm8shun

    Joined:
    Jul 14, 2007
    Posts:
    476
    Alright, so I've made a lot of progress. Still have some questions though.

    I'm using the tutorial file for dragging objects. However, I'm using it a bit differently than the example. The posted sample script is:

    Code (csharp):
    1.  
    2. function FingerGestures_OnDragMove( fingerPos : Vector2, delta : Vector2 )
    3. {
    4.     if( draggedBody )
    5.     {
    6.         // convert the finger position to world position
    7.         var distToCamera : float = Mathf.Abs( draggedBody.transform.position.z - Camera.main.transform.position.z );
    8.        
    9.         var fingerWorldPos : Vector3 = Camera.main.ScreenToWorldPoint( new Vector3( fingerPos.x, fingerPos.y, distToCamera ) );
    10.    
    11.         // center the object on our moving finger
    12.         draggedBody.MovePosition( fingerWorldPos );
    13.     }
    14. }
    The problem is that I'm dragging an image that is much larger than what the camera can see (imagine panning around a really big image). The script currently moves the center of the image to the finger every time I start to move, where I need it to simply add the movement to the current position. Can I please get some guidance on how to make this work?
     
  5. newborne

    newborne

    Joined:
    Jul 16, 2012
    Posts:
    31
    Hi!

    Thanks for this wonderful package!

    I have some problems with MacOS trackpad, it works fine in all platforms android,ios with touches and web,windows and mac with mouse but it fails to work properly on MacOS trackpad.

    using mouse with MacOS gives me results as it should
    both left + right mouse button and drag = pan
    mouse scroll = zoom
    left mouse button + drag = rotate
    but on MacOS trackpad two finger drag does not give me pan it gives me zoom, this work on all platforms iOS,android,web,win and mac but it fails on trackpad, is there a workaround to this? or i am doing something wrong! thanks for this nice asset btw!
     
  6. ZnoeySZI

    ZnoeySZI

    Joined:
    Nov 19, 2012
    Posts:
    6
    Hey All,

    It seems like there **might** be an issue with finger gestures with unity 4 or with its latest package OR with how I am using it for one of my projects. On android, sleeping the device and returning to the app breaks finger gestures. Am i absolutely sure its FG? no... However EZGUI's polling doesn't stop working. Neither does our custom input stuff for other pieces. There are two things I use finger gestures for and both of those stop working when sleeping then returning to the app.

    I'm sure this can't be it but... the method i'm using is i have a non-persistent Finger Gestures Initializer in my scene, another main script hooks into the standard finger movement events in OnEnable, and unhooks in OnDisable. Only one script does this.

    This wasn't happening prior to our Unity 4 update. Has anyone encountered this before?

    EDIT: After some investigation, it appears that FingerGestures is sending an incremented fingerIndex into the OnFingerDown callback. In my app, if its not the first finger down (index 0) then i drop all logic and skip through processing it. It looks like the fingerIndex gets incremented by 1 every time the android device is put to sleep then reopened on the application. This incrementing occurs 5 times (for indices 0-4) then my app stops getting the callbacks from FingerGestures.
     
    Last edited: Nov 27, 2012
  7. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    170
    Hi everyone -

    I'm investigating using FingerGestures with a multitouch table that generates TUIO touch messages (generated by the CCV open-source computer-vision-based multitouch software).

    Has anyone had good (or bad) experiences using FingerGestures with either uniTUIO or Mindstorms' unity3d-tuio frameworks for getting TUIO messages into Unity?

    Thanks in advance for any tip you can share!

    --Ien
     
  8. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    I'm implementing pinch to zoom and I'm noticing that it doesn't seem to register a pinch if one finger is stationary. That seems wrong to me.
     
  9. ITEKUBE-France

    ITEKUBE-France

    Joined:
    Oct 9, 2012
    Posts:
    4
    Yes i'm using FingerGestures with Mindstorms and it works fine but... you'll have to modify few lines in FingerGestures and a lot in Mindstorms to add common input transformation.
    I have a bug with uniTUIO when there are a lot of gameobjects in the scene, that's why i switched to Mindstorm but you can try it as you don't have to modify it to work with FingerGestures.
     
  10. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    170
    Thanks. I also decided to focus on Mindstorms as it seems more streamlined. I am adding TUIO 1.1 blob (i.e. tuio/2Dblb) support. Is there a public repo to contribute to the Mindstorms project? It'd be great if we could all share our additions to that project.
     
  11. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Not sure if this has been raised previously, but I have an object on which I'm implementing both single and double tap:

    Code (csharp):
    1.  
    2. FingerGestures.OnFingerTap += FingerGestures_OnFingerTap;
    3. FingerGestures.OnFingerDoubleTap += FingerGestures_OnFingerDoubleTap;
    4.  
    When I double-tap the object though, it fires two singles followed by a double. Is there any way to prevent that (i.e. to just fire a double event)?
     
  12. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    170
    The more I investigate FingerGestures, the more I like it. Congrats on what looks like a really great product.

    Question: does it support multiple multiple-finger gestures, i.e. two or three users all doing a two-finger pinch at the same time? If it doesn't support this sort of thing natively, would this be straightforward (for a programmer) to extend into your architecture?
     
  13. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Sorry to bump this so soon, but really keen for an answer. Found this thread:

    http://forum.fatalfrog.com/index.php?topic=20.msg57#msg57

    Which seems to indicate that the product doesn't handle this. Wondering if this has since been addressed or if there's a convincing workaround? Being able to assign different functionality to "clicking" and "double-clicking" seems to be a pretty essential feature to me.
     
  14. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    170
    I just got Mindstorm TUIO <--> FingerGestures working, though not thoroughly tested yet. What's interesting is that I took a different approach than you. Zero change to the Mindstorm TUIO (but really only using the lower level parts of it), but a whole new subclass of the FingerGestures class in Finger Gestures. Now I'm working on getting TUIO 1.1 blob support working and also thinking about how to add multiuser multi-finger support, which may be the trickiest part.
     
  15. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Is there no more support in here?
     
  16. Alayna

    Alayna

    Joined:
    May 4, 2012
    Posts:
    4
    I bought your asset a little while ago and it performs great, honestly its worth it for the camera orbit script alone! I had one question though, will this work with windows 8?
     
  17. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    340
    Hey,
    I'd like to drag an object without modifying the rigidbody. Do someone do that ? I have no luck with my first trys. Maybe i missed an exemple ?

    Edit : I think i just found my answer looking at the toolbox drag and drop sample.
     
    Last edited: Dec 23, 2012
  18. 10yaseen1

    10yaseen1

    Joined:
    Oct 27, 2012
    Posts:
    14
    Is this in JS or in CS because I need this in JS

    :)
     
  19. Hrvatss

    Hrvatss

    Joined:
    Oct 26, 2012
    Posts:
    9
    Would be nice to have a javascript package
     
  20. ITEKUBE-France

    ITEKUBE-France

    Joined:
    Oct 9, 2012
    Posts:
    4
    Ghopper21, i made some changes too :)
    I don't modify MindStorm TUIO anymore, I made a new subclass but in MindStorm plugin and like you, i'm only using lower parts.
    I found this way more useful as i'm not using fingergestures in all my projects.
    You can view it in action (preview version) here : http://www.youtube.com/watch?v=3NjKLEpvZg4
     
    Last edited: Jan 20, 2013
  21. netlander

    netlander

    Joined:
    Nov 22, 2011
    Posts:
    28
    I am trying to use both a drag and tap on the same object, is there a straight forward way of doing this so that when the object is tapped we take a particular action and when it's dragged we do something else.

    At the moment it's behaving OK 90% of the time but then if it detects a slight drag with a tap both events are fired and my logic goes haywire.
     
  22. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    Any way to (temporarily) disable fingergestures globally? Like if the game is paused, I want to disable fingergestures (ngui is handling UI input).

    edit: Looks like I can disable/enable the MouseGestures script the initializer creates. I assume on touch devices, it's FingerGestures I need to look for.

    edit2: Got it.
     
    Last edited: Jan 28, 2013
  23. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    If I understand correctly, you're wanting to differentiate between a stationary/quick tap and a moving/prolonged drag in a way where both can be initiated by a new touch on an object. So your best bet might be to wait a few frames and check for drag movement. If there's been enough movement, act on it as if it were a drag. If it's under your threshold, act on it as if it were a tap. There'll be a slight delay since you can't really predict what it is until you measure it, but I'm not sure what else you could do.
     
  24. nm8shun

    nm8shun

    Joined:
    Jul 14, 2007
    Posts:
    476
    I'm unable to find this example on the support site or the sample files...can you direct me towards it?
     
  25. nm8shun

    nm8shun

    Joined:
    Jul 14, 2007
    Posts:
    476
    I think I found it but it was in C#, I'm having some problems converting the code chunk into UnityScript....(problems with the getter/setter mechanism). Here's what I've got:
    Code (csharp):
    1.  
    2. var pinching:boolean = false;
    3.    
    4. class Pinching
    5. {
    6.     get { return pinching; }
    7.     set
    8.     {
    9.         if( pinching != value )
    10.         {
    11.             pinching = value;
    12.         }
    13.     }
    14. }
    15.  
    16. class PinchAllowed
    17. {
    18.     get { return inputMode == InputMode.PinchOnly || inputMode == InputMode.PinchAndRotation; }
    19. }
    20.  
    21. function FingerGestures_OnPinchBegin(fingerPos1:Vector2,fingerPos2:Vector2 )
    22. {
    23.     if( !PinchAllowed )
    24.         return;
    25.  
    26.     Pinching = true;
    27. }
    28.  
    29. function FingerGestures_OnPinchMove( fingerPos1 : Vector2, fingerPos2 : Vector2, delta : float )
    30. {
    31.     if( Pinching )
    32.     {
    33.         // change the scale of the target based on the pinch delta value
    34.         target.transform.localScale += delta * pinchScaleFactor * Vector3.one;
    35.     }
    36. }
    37.  
    38. function FingerGestures_OnPinchEnd( fingerPos1:Vector2, fingerPos2:Vector2 )
    39. {
    40.     if( Pinching )
    41.     {
    42.         Pinching = false;
    43.     }
    44. }
    45.  
    Any guidance on getting this to work in JS would be much appreciated.
     
  26. MSFX

    MSFX

    Joined:
    Sep 3, 2009
    Posts:
    116
    Last edited: Jan 29, 2013
  27. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    I just started a new project and noticed I got TWO FingerGestures as packages by default in the project window.

    So I dig into the directory where Asset Store store the packages and found :

    .../Scripting/FingerGestures.unitypackage (Date: 2012-03-07)
    .../ScriptingInput - Output/FingerGestures.unitypackage (Date: 2012-02-22)

    I am wondering if I can delete one of them? Does this happen often? Did this happen when you moved the FingerGesture package to other section of the Asset Store?
     
  28. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Hi

    As the most of you knows, tablet devices more and more works with standard desktop operating systems too, like Windows 8 Pro.
    (Look for >> Lenovo ThinkPad S230u, Samsung ATIV smart PC Pro, Asus Transformer Book TX300CA) All with much faster Intel i5,i7-CPU and GPU than any Android tablets has.

    Probably also Apple could promote a Notebook/Tablet device next as it is an innovative combination of a full power notebook with the comfort and the look feel of a tablet.

    What should that means: That we must have support of multitouch inputs also for a standalone compilation of our projects.
    (And input: accerleration too.)

    Especially right now for Windows 8 Pro. So because Unity it selfs is sleeping here (as often for new innovations) we must pay for additional extensions in the AssetStore. FingerGuesture cost 55 USD and for this, it should support multitouch display inputs of Windows 8 tablets too in the standalone player. How ever you made that (DLLs/PlugIns)

    Thanks to stay innovativ!
    Roman
     
  29. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    Hi

    I'm trying to get a camera to orbit around an object when players drag it on the iPhone. I just got v3.0 and the TBOrbit script works really well for this :). I'm having a problem that it orbits no matter where the player drags on the screen. I only want the camera to move when the player drags on the object. I added a collider to the object and ScreenRaycaster script to the cam. This shows the rays in the editor go red when the player drags off the object. This is exactly what I want except the camera still orbits when the rays change from green to red? How can I stop the camera from getting input when the rays are red?

    v3.0 is really good and example scenes are really helpful too.

    thx,
    Mishaps
     
  30. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    This is one of the next stuff on my list - adding TOUI support which I think should do the trick for this. Will probably be part of the 3.1 release. I started working on it but did not manage to finish it in time for the 3.0 release.
     
  31. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hi Mishaps,

    You had the right instinct on this (adding ScreenRaycaster to it) but sadly it's just not supported by the TBOrbit right now. That's a great idea though and should be pretty easy to add in the next update. Added it to the todolist ;)
     
  32. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hi! Sorry for the slow reply, but in case you still need this, here's a fixed javascript version that should work:

    Code (csharp):
    1.  
    2. var Pinching:boolean = false;
    3.  
    4. bool PinchAllowed()
    5. {
    6.    return inputMode == InputMode.PinchOnly || inputMode == InputMode.PinchAndRotation;
    7. }
    8.  
    9.  
    10. function FingerGestures_OnPinchBegin(fingerPos1:Vector2,fingerPos2:Vector2 )
    11. {
    12.     if( !PinchAllowed() )
    13.         return;
    14.  
    15.     Pinching = true;
    16. }
    17.  
    18. function FingerGestures_OnPinchMove( fingerPos1 : Vector2, fingerPos2 : Vector2, delta : float )
    19.  
    20. {
    21.  
    22.     if( Pinching )
    23.     {
    24.         // change the scale of the target based on the pinch delta value
    25.         target.transform.localScale += delta * pinchScaleFactor * Vector3.one;
    26.     }
    27.  
    28. }
    29.  
    30. function FingerGestures_OnPinchEnd( fingerPos1:Vector2, fingerPos2:Vector2 )
    31. {
    32.         Pinching = false;
    33. }
    34.  
     
  33. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    I was thinking parent a trigger to the camera a bit like you would with NGUI and only trigger the orbit when the drag goes over that region. If the rays from ScreenRaycaster go green when you drag over it and red when your not there must be code in fingerGestures detecting it :confused: I jsut want to wire that detection into my own game logic. Good to hear its on the to do list anyway :) cheers.
     
  34. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Latest FingerGestures running in Unity 4.1 error:



    SOLUTION: just had to delete the old "Finger Gestures Initializer" prefab from my scene and drag it in again from the new package.
     
    Last edited: Mar 15, 2013
  35. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Oh yeah, I forgot to mention this in the upgrade instructions, thanks for pointing it out!
     
  36. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hm one thing you could try in the meanwhile is adding a custom component on that invisible trigger/collider that would listen to OnDrag event and enable/disable the TBOrbit script on drag start/end. That could do the trick :) Just make sure your DragGestureRecognizer is setup to broadcast event messages and has a ScreenRaycaster component set.
     
  37. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    thanks for the suggestion I'll give it a try :)
     
  38. Mr-Knieves

    Mr-Knieves

    Joined:
    Mar 7, 2013
    Posts:
    41
    Just noticed this package got a HUGE update, had a bunch of errors but soon I realized it was my mistake, loving the new implementation, seems way cleaner than before and modifying my project to the new system took just a couple minutes.

    Thanks for the awesome work and support!
     
  39. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Thank you Knieves, glad to hear you're happy with it. It's been a long time coming, but it's finally out. The plan is to have smaller, more regular updates in the future as well.
     
  40. nemoryoliver

    nemoryoliver

    Joined:
    Nov 19, 2012
    Posts:
    38
    Why FingerGestures won't work in my android device? I am using a Galaxy S3. I have run the basic gestures scene sample. and my app is always stock in the splash screen. I even followed the quick tutorial in an empty project and still my app is stuck in the splash screen. if I remove all fingergesture component in my project heirarchy then my app won't stuck any more. it means it is really FingerGestures cause the problem. How to fix? It runs well in Unity Editor.
     
  41. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    In Camera/Toolbox-Pan example, how to drag the box where the camera is stop to pan?
     
  42. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Just updated the site first post with info on the new v3.0 release.
    Thanks for your continued support and feedback!
     
  43. Rampa

    Rampa

    Joined:
    Jul 12, 2012
    Posts:
    7
    Hi

    I have an issue with FingerGesture.
    I'm trying to create a new "PointCloudGestureTemplate" following your doc : "Creating Gesture Templates From Code"
    I get an error :

    NullReferenceException: Object reference not set to an instance of an object
    PointCloudGestureTemplate.BeginPoints () (at Assets/Plugins/FingerGestures/Scripts/Gesture Recognizers/PointCloudGestureTemplate.cs:49)



    Basically it tells me that in the line :
    positions.Clear();
    The variable positions is null (I beleive there is the same issue with the variable "strokeIds")

    I've checked your code and I can't find where the variable is allocated (I don't see any "new" statement)

    Am I missing something?

    Best regards
    Rampa
     
    Last edited: Mar 21, 2013
  44. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Ooops, bug's on me :( *blushes*
    The strokeIds and positions lists are not properly initialized - I thought I had fixed that one but must have messed something up. The error doesn't happen when creating gesture templates from the editor because these two fields are automatically new'ed by Unity (they are serializable). This doesn't happen when created from code.

    Add the following method to the PointCloudGestureTemplate class to fix the issue:

    Code (csharp):
    1.  
    2. void Awake()
    3. {
    4.         // initialize the collections properly in case we're creating this by code
    5.         if( positions == null )
    6.             positions = new List<Vector2>();
    7.  
    8.         if( strokeIds == null )
    9.             strokeIds = new List<int>();
    10. }
    11.  
     
  45. nemoryoliver

    nemoryoliver

    Joined:
    Nov 19, 2012
    Posts:
    38
    @spk can you help me please?

    Why FingerGestures won't work in my android device? I am using a Galaxy S3. I have run the basic gestures scene sample. and my app is always stock in the splash screen. I even followed the quick tutorial in an empty project and still my app is stuck in the splash screen. if I remove all fingergesture component in my project heirarchy then my app won't stuck any more. it means it is really FingerGestures cause the problem. How to fix? It runs well in Unity Editor. Thank you so much.
     
  46. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hi Nemory,
    I already answered your original PM on that same question, but I'll post it here again for others:

    There is apparently a glitch with Unity on Android when the same identifier is used for a generic and non generic class (namely, the GestureRecognizer and GestureRecognizer<T> classes). This causes problem with scene serialization and that would explain why the app gets stuck on load. I will include a fix for this in the next release but in the meanwhile, simply rename the generic GestureRecognizer<T> to GestureRecognizerGeneric<T> in GestureRecognizer.cs, that should fix the problem.
     
  47. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    A quick question for anyone here. I'm 90% designer and just getting my scripting mojo up to speed. My question is, for a game where I had spawning items or other gameObjects on screen, for example:

    Say I have a wave of enemy prefabs coming onscreen, and I want to tap them (or double tap or whatever), to destroy or despawn them...maybe instantiate an explosion, play a sound or increment the score once they are gone. My first thought would be the code would exist on the prefabs to be spawned, but I'm not sure with FG where these type of prefab specific instructions should go.

    thanks,
    B.
     
  48. nemoryoliver

    nemoryoliver

    Joined:
    Nov 19, 2012
    Posts:
    38
    Wasn't able to see your reply but it works now. Thanks a lot bro. And I need another help. I tried LongPressRecognizer, I want to be able to run a function when the user is done pressing. Is there a way to do that in FingerGestures? Also do something like that in the OnTap, OnSwipe.
     
  49. nemoryoliver

    nemoryoliver

    Joined:
    Nov 19, 2012
    Posts:
    38
    nevermind. I saw FingerMotionDetector and did the job. Perfect!! I am really loving your plugin. Great Job!!
     
  50. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    Hi .. just wondering how I'd constrain Dragging to a plane ?

    I have a simply ball that I am trying to drag about on a table surface.