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
    Not yet, but it's still on the long todo-list :p
     
  2. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Could you give me more details on what you want to do, and what script you are using please?

    Thanks for the kind words :)
     
  3. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hi Karl, sorry for the slow reply, was away for a bit.
    Do you still need help with that, or did Dave's answer helped you sort this out?

    @Dave: thank you for helping out ;)
     
  4. ratjar_games

    ratjar_games

    Joined:
    May 13, 2012
    Posts:
    17
    Hi, Ive figured it out that you need a collider as the parent object. so that all works fine just had to rearrange some prefabs :)

    The only thing i need a hand with now is my previous message, rotating individual game objects if you do the pinch rotate gesture in say, a trigger area, rather than the whole screen rotates one.

    No worries, you deserve it!
     
  5. karljj1

    karljj1

    Joined:
    Feb 17, 2011
    Posts:
    440
    ,

    Hi Spk

    Daves answer worked for me. I could do with some advice on your TBDragOrbit camera script. I want to be able to scale the zoom and pan speeds based on how close i am to the ground. I am using an animation curve to give me my scale factor but am unsure where to apply it. So far I am using it on the delta value like so:

    Code (csharp):
    1.  
    2.     void FingerGestures_OnPinchMove( Vector2 fingerPos1, Vector2 fingerPos2, float delta )
    3.     {
    4.         if( allowPinchZoom )
    5.         {
    6.             // Adjust the delta based on altitude
    7.             float ratio = Mathf.Clamp( ( transform.position.y ) / maxSpeedAlt, 0, 1.0f );
    8.             delta = Mathf.Clamp( delta, -altitudeSpeedModifier.Evaluate( ratio ), altitudeSpeedModifier.Evaluate( ratio ) );
    9.  
    10.             IdealDistance -= delta * pinchZoomSensitivity;
    11.         }
    12.     }
    13.  
    It works ok but at times can be very jittery. I don't know if this is due to the uniTUIO though?
    What would you suggest as a way to scale speed better.

    Thanks

    Karl
     
  6. jtfrench

    jtfrench

    Joined:
    Mar 21, 2012
    Posts:
    9
    Hi Spk,

    I recently took a ready through the tutorials that you have on FingerGestures.com, and I think I'm starting to get a grasp on things. Currently I'm trying to emulate the behavior you have in your "Toolbox-OneFingerGestures" sample scene. I'm looking to make a swipe-based/"carousel" style gallery (kind of similar to the Cover Flow thing Apple popularized)

    What I have is a bunch of textured box collider-containing planes in a scene, each of which has the "TBSwipe" script attached to it, along with a custom script of mine which defines "OnSwipeRight" / "OnSwipeLeft" methods (right now, they just do a simple Debug.Log() print out). Additionally, I have a Game Object which has the TBInputManager script attached, and then I have the "Finger Gestures Initializer" prefab in the scene.

    When I hit play, if I swipe right, I correctly see the Debug.Log statement that I have written in "OnSwipeRight()" appear, and the same for swiping left.

    However, the second time that I try to swipe right or left, nothing gets triggered. I'm not sure if this is an issue that's already been discussed (couldn't find anything), but can you tell me what I'm doing wrong here?

    Thanks,
    Jason
     
  7. jtfrench

    jtfrench

    Joined:
    Mar 21, 2012
    Posts:
    9
    Wow, the bug I had was all due to the "Collapse" setting being active in my Console window. Countless hours lost thinking it was something else. fml.
     
  8. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hehe I know this one, it also got me pulling my hairs for a whole day till I figured it out :p

    Hm I haven't had any reports of that nature... I don't think it's a bug in FG as the Toolbox-OneFingerGestures swipe wouldn't work either if it was the case. Have you verified that?
     
  9. Bugfoot

    Bugfoot

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

    I would create a "DragOrbitController" script that would set the zoomSpeed and panSpeed (I forgot the exact property names, but you get the point!) on the TBDragOrbit component based on the distance to the ground, from the Update() method. It would be cleaner as you wouldn't have to modify the existing TBDragOrbit script to apply your chances.

    As for the jitter, it's most likely due to hardware input refresh rate limits on your device than software issue.
     
  10. imphenzia

    imphenzia

    Joined:
    Jun 28, 2011
    Posts:
    413
    I bought the package today and it seems to be working alright, sort of =)

    I have created three touch GUI buttons for controls (left thumb = go up when pressed and right thumb has left/right).

    I use FingerGestures_OnFingerDown and FingerGestures_OnFingerUp for the buttons to detect when they are pressed and released and I use the finger index to associate it to the particular button hold.

    This works on my "HTC Desire" and a "HTC Desire HD" - but on the HTC One X it's not possible to hold the left thumb button down and then presses with the right thumb it releases the left thumb press.

    Here is my code for the thumb buttons:
    Code (csharp):
    1.     void FingerGestures_OnFingerDown( int fingerIndex, Vector2 fingerPos ) {
    2.         // skip if we're already holding another finger stationary on our object
    3.         if( stationaryFingerIndex != -1 )
    4.             return;
    5.  
    6.         _ray =  GameObject.Find("Sprite Camera").camera.ScreenPointToRay (fingerPos);
    7.         if (Physics.Raycast(_ray, out _hit, Mathf.Infinity)) {
    8.             if (_hit.collider == transform.collider) {
    9.                 isFingerDown = true;
    10.                 stationaryFingerIndex = fingerIndex;
    11.                 gameObject.GetComponent<exSprite>().color = new Color (_oColor.r, _oColor.g, _oColor.b, 0.8f);
    12.             }
    13.         }
    14.     }
    15.  
    16.     void FingerGestures_OnFingerUp( int fingerIndex, Vector2 fingerPos, float timeHeldDown ) {
    17.         if( fingerIndex == stationaryFingerIndex ) {
    18.             gameObject.GetComponent<exSprite>().color = new Color (_oColor.r, _oColor.g, _oColor.b, 0.2f); 
    19.             isFingerDown = false;
    20.             // reset our stationary finger index
    21.             stationaryFingerIndex = -1;
    22.         }
    23.     }
    Is this a multi-touch issue and can I do something about it? =)

    Update: The Desire has simulated two fingers and the Desire HD has 4 real fingers according to the multitouch tester. I am guessing it is something else that gets HTC One X to send an OnFingerUp (incorrectly?)
     
    Last edited: May 23, 2012
  11. tgraupmann

    tgraupmann

    Joined:
    Sep 14, 2007
    Posts:
    828
    Use the multitouch tester in the play store. Some devices only support two touches. The toshiba thrive (4) and the samsung galaxy tab (10).

    I tried all 10 fingers with the galaxy tab, and then my nose but sadly just 10 touches. Ah the possibilities.
     
  12. imphenzia

    imphenzia

    Joined:
    Jun 28, 2011
    Posts:
    413
    Thanks for the tip. My problem is the other way around though - it fails on the multitouch device supporting 10 touches and it behaves as I describe in the post above.
     
  13. ratjar_games

    ratjar_games

    Joined:
    May 13, 2012
    Posts:
    17
    William, Hello again. Ive been moving so have been internet-less for weeks. how depressing. Anyway I was wondering if you could give me a hand with this, never solved it as Unity 3.5.2 crashed my game and I've been rebuilding for days. finally back up to speed (just weeks behind), but i could really do with a hand so I'm not spending days on this, had a look at it all morning I'm not getting it.

    Basically I need to rotate INDIVIDUAL game objects, by pinching a trigger area around them. Im getting that using method 1 in your wiki to use a ray cast, and if it hits a certain object with a tag then the object becomes rotatable? perhaps?

    Anyway then i need to add the rotation functionality, should i do this in a separate script or what? as you have the components with rotation included, I'm confused, and I'm rather embarrassed because I'm usually extremely competent with working these things out :p (Not to mock your program of course, just getting back into the rhythm of things).

    Any help would be greatly appreciated, from anyone! Somebody must know how to do this.. that would be great, cheers guys :)
     
  14. citizen12

    citizen12

    Joined:
    Oct 29, 2009
    Posts:
    15
    Hi William,

    I have been using your FingerGestures for a few months now. It works very well and I am quite happy with the purchase.

    I am wondering if there is something you can help with. I have some UI elements that are GUITextures. I am using FingerGestures to catch taps on my UI elements and handling them just fine. But the taps are ALSO being handled by my game code, which causes the user to inadvertently tap on items in the game scene that are hidden beneath the GUITexture element. How can I go about intercepting the taps so that if a tap occurs on a UI element it is not also sent to the game components that run underneath?

    Thanks,
    James
     
  15. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    Hi William,

    Where are you... :) Your site is down atm and I'll need some help...
     
    Last edited: Jun 23, 2012
  16. TESTsim

    TESTsim

    Joined:
    Jun 21, 2012
    Posts:
    8
    +1

    I have written too on your forum a couple of days ago without any answer.
    Please, come back with us soon! :)
     
  17. netlander

    netlander

    Joined:
    Nov 22, 2011
    Posts:
    28
    Hey Spk,

    Amazon have a solid infrastructure which, while probably not the cheapest, scores high in terms of flexibility and resilience. And they're not all that pricey. In fact we have used AWS Free Usage Tier to host basic websites previously, it's entirely free and could be an interim step while you look for a more robust solution to your hosting needs. Check it out here: http://aws.amazon.com/free/

    Hope this helps
    All the best
    Paul
     
  18. tnaseem

    tnaseem

    Joined:
    Oct 23, 2009
    Posts:
    149
    Hmm... This is worrying...

    NOTICE: This domain name expired on 06/21/2012 and is pending renewal or deletion.
    fatalfrog.com
     
  19. BryceK

    BryceK

    Joined:
    Jun 15, 2012
    Posts:
    24
    To bad the site is down, I could really use some help figuring out you product :) could you upload all you documentation on like a wikia site? would be more exassable for everyone.
     
  20. netlander

    netlander

    Joined:
    Nov 22, 2011
    Posts:
    28
    Lots of developers are on urgent deadlines. While we sympathise with your plight, we also have to get on with our commitments and the documentation for your plugin is essential at this moment in time.

    Why don't you make the website's source available for download as a zip file so we developers can still have access to the documentation while you're looking for a home to your site?

    Cheers
    Paul
     
  21. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hey guys,

    Sorry for the scare, I've had a crazy mixture of real-life BS and hardware failure that have kept me off the grid for the last few weeks. I'm getting stuff under control now; I should be back up and running soon and I intend to fully make up for the lost time. As for the domain, I have just made an emergency renew on godday, even though I was certain I had transferred the domain ownership to my new host. Isn't it funny how everything blows up at the same time in life? :)

    I'm planning a big come-back for FingerGestures with a fat 2.4 update, and get the support back on track. I deeply apologize for any frustration that the recent hick-ups and idleness might have caused to any of you, and I will do my best to make things right again!

    As for the documentation, it should be back up at http://fingergestures.fatalfrog.com/wiki

    Over the next day or two I will get back to each of you to answer your questions, so please bear with me while I finishing tying a few remaining loose ends.
     
    Last edited: Jun 25, 2012
  22. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    Ah great to hear that, wb!
     
  23. netlander

    netlander

    Joined:
    Nov 22, 2011
    Posts:
    28
    Good to hear you're sorting things out!
     
  24. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
  25. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hi Jacob, big apologies for the delay - as you've probably noticed from the posts above, I also had my own troubles...

    Anyways, in case this isn't too late, let me try to help you out :) If you want to rotate individual objects using a pinch gesture, here are a few pointers/things to know:
    - the pinch gesture is global, which means that at the moment, you will only be able to have the user perform one pinch at once
    - the pinch position returned by the pinch gesture is the center of the two pinching fingers (pivot point). You could use that centered position to perform a raycast from, and figure out if there's an object to rotate underneath
    - to update the object rotation, you can use the pinch delta angle for rotation speed, and its sign for rotation direction (clockwise or counter-clockwise)

    As to how to implement this in practice: I would create a "manager" script (only 1 instance needed in your scene) that registers to the default pinch gesture events (e.g. OnPinchMove) and is responsible for performing the raycast/finding valid objects to rotate around the pinch pivot point. You can either give your objects with a special tag, or equip them with a special script that could allow you to specify extra properties on a per-object basis (e.g. a rotation speed modifier).

    Does that make sense? Let me know if you need more help with this.
    Good luck!
     
  26. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    In my projects, I solve this on a case-by-case basis in the gesture event handlers by checking whether or not the finger is above a UI rectangle/zone before proceeding with my gesture handling logic. There a couple of more advanced approaches such as providing a "CanBeginDelegate" to the gesture recognizers that should perform that type of check, or you could also specify a global touch filter via FingerGestures. (but that will affect ALL gesture recognizers). Here's a forum thread with more information on how to do this: http://forum.fatalfrog.com/index.php?topic=63.msg296#msg296.

    In the end though, I found it simpler handle this on a case-by-case basis.
    Let me know if you need more details on this.
     
  27. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Thank you for your suggestion Paul, but I already got a good host now. Im using StableHost, and am very happy with it. The recent domain name issue was my fault, as I was sure I had also transferred the domain to my new host, but apparently not :\
     
  28. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
  29. ratjar_games

    ratjar_games

    Joined:
    May 13, 2012
    Posts:
    17
    PERFECT, gotcha, don't worry about it matey I've been busy for a few weeks moving flat and whatnot. glad your back though! :) yeah, I've basically done all of that, including a script for objects with variable rotation speeds etc, i was just wondering what the easiest way of finding the center point of two touches would be? I assume it will be some form of finding the difference and working from there but how would you go about that? Thanks for the support though, very helpful :)

    EDIT: Got it, simpler than i thought.. haha :)
     
    Last edited: Jun 30, 2012
  30. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    I'm looking at this asset as a possible solution for my current project. Just wanted to check something.

    I'm primarily looking for something that will allow me to set up drag and drop inventory manipulation in a 2D (NGUI) interface. Basically along the lines of any common RPG - dragging a sword from the character's inventory to their hand slot etc.

    What I'm wondering is whether or not this is going to be easily achieved (i.e. working more in a 2D realm than in 3D), and also, how the "drop zones" work in this context - i.e. that hand slot for example; would it simply be a set of coordinates (a Rect), or is there some sort of receiver for the drop?

    Let me know if I'm not making sense. I'm known to cause confusion :)
     
  31. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    I William some days ago I sended to you a test project via PM from your forum.

    Did you checked it?

    Thanks
    Kenshin
     
  32. Madgeniy

    Madgeniy

    Joined:
    Apr 21, 2012
    Posts:
    14
    Hello!
    I have a question. I want to implement behaviour like ipad "new notfications bookmark" (top position, when move finger from top to down, it's showing for us).
    I tried to implement this by using swipe gesture recognizer and move recognizer, but it recognize finger position only when finger "y" position over about 80 pixels from a bottom position. Please, help me to recognize finger position correctly using thins library. Thanks.
     
  33. Krodil

    Krodil

    Joined:
    Jun 30, 2010
    Posts:
    141
    Hey. I have attached PickObject (JS) to the mainCam and also the PinchRotationSample (C#).
    I wish to change the 'target' in PRSample from whatever the PickObject script hits, but I fail incredibly much in this. :)

    I have this code:
    I tried various combos with or without SampleBase, target etc. and moving the scripts around to battle compilation order.

    I get following error with samplebase, target etc. : 'SampleBase' is not a member of 'UnityEngine.Component'.
    Any tips?
    /Kro
     
  34. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Hi Willaim, I am getting a strange error after recent update.

    "Assets/Plugins/FingerGestures/Components/MultiTapGestureRecognizer.cs(68,34): error CS0103: The name `ElapsedTime' does not exist in the current context"

    This is with latest update, with an empty new project.

    Should I just ignore that?
     
  35. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hi Krodil,
    Can you clarify what you are trying to achieve please? I'm not sure I understand :)

    Also, the sample scripts such as PinchRotationSample are not meant to be used as "components" on your own stuff. They're very specific to the samples and just show you how to use the FingerGestures API in your own code. Unless you're modifying the sample to learn/test some stuff, you should really not be using it or have to call methods in the SampleBase class. These are internal classes meant to be used by the samples only.
     
  36. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hm strange, which package version did you use? Also, did you download it from my forums, or from the Asset store? Have you tried to re-extract it?
     
  37. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    The very latest version from Asset Store I downloaded 3 days ago. I can't remember the version number (I am not on my Development PC with Unity on it).
    I tried re-download/re-extracting it from Asset Store, same error message. I also started with brand new project and import it in, still same message.
     
  38. AppBite

    AppBite

    Joined:
    Jul 5, 2012
    Posts:
    79
    I've been doing some research on Gesture packages I'm liking the look of FingerGestures, just a couple of questions.

    It looks like I could do the "Angry Birds" style drag, hold, release type of action with the OnDragBegin/End functions, correct ?

    But not the "Fruit Ninja" style Swipe (with angle distance) until the swipe stuff on your roadmap is done ?
    My preference would be for an open angle approach rather than 8 cardinal points, but I think I could work with 8 if you got to that first.

    Thanks!
     
  39. Bugfoot

    Bugfoot

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

    Yeah the angry bird style drag/drop should be easy to implement using the Drag gesture. As for the "fruit ninja" swipe, you could probably implement that yourself using the drag gesture too, but it would indeed make more sense for me to make the swipe gesture more configurable in that regard, for the next update.
     
  40. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Odd, you're the only person that's been reporting this issue so far, and this version has been out for a while now... I'll look into it today and see if I'm having any issues here. What version of Unity are you running, and are you 100% sure you are importing the FingerGestures package verbatim, without any extra cutom changes/modifications?
     
  41. Krodil

    Krodil

    Joined:
    Jun 30, 2010
    Posts:
    141
    @SPK
    Hey,
    I have attached a crude drawing.
    Basically I spawn objects on a plane and I have implemented pinchZoom and dragOrbit.
    I have also used PickObject to 'send message' to pinchrotationSample on which object is target. This does not work when compiled on the Motorola Xoom tablet I use. The target is set but no rotation. Do I need to set the ´'Input Mode Button Rect'?
    The camera is perpendicular to the plane.

    My plan is to spawn objects on an x,z plane to kinda let the player re-create a scene based on objects available from the GUI. then have the possibility to:
    1: pan the screen which is parallel with the plane: works
    2: Zoom:works
    3:move objects on the plane. :works
    4:rotate/scale individual objects
    5: Rotate the camera around the scene

    I know its a lot, but any pointers on the rotation of objects?
    Any points in general on how to achieve this?
    All the best and thank you,
    Kro
     

    Attached Files:

  42. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    432
    @SPK : how would you modify the TBDragOrbit script so that, instead of performing the same global zoom wherever your fingers (or mouse cursor) are positioned, it would zoom to this position - like in modo, SketchUp, etc. ? it would feel way more natural this way, I think.
     
  43. Bugfoot

    Bugfoot

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

    The pinch gesture on the TBDragOrbit affects the "distance" to the target object. The TBDragOrbit is designed to always be facing this target object, so it won't work if you want to have the camera look away from it when zooming on another part of the screen, for instance.

    In order to accomplish what you want, the orbiting and view-alignment logic should be split up, so that the orbit script only affects the camera position, and another "controller" script would set the camera direction/angles.

    In order to have the view always look at where the user is pinch-zooming at, you should make the camera turn toward the the pinch gesture's center point, which is the average of the positions of the two pinching fingers. Basically, you must convert the 2d/screen-space pinch center point to a world-space point that you can then have your camera turn toward, thus keeping the pinch-zoom direction in focus.

    Please let me know if this isn't clear enough, I'm not sure if I explained it very well :\
     
  44. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    So for individual object rotation, I suppose you want to use the two-finger rotation gesture, right? There are many approaches to do this, and it really depends on how you want the users to interact with your objects.

    I would go for a two-steps approach where the user first has to select an interactive object, using a tap or something similar. Then, I would use the rotation gesture to rotate the currently selected object.

    Implementation-wise, I would have a kind of "Input Manager" object that is in charge of listening to the tap or rotation gesture, and also keep track of the currently selected object. In the finger tap event, you would perform something similar to what is demonstrated in the PickObject.js sample script: basically, raycast into the scene to find out which object has been selected, and then set this object as the current selection. Then in your rotation gesture event handler, you would use the provided "delta" value (the change in rotation angle since last call) to rotate the currently selected object around its Z axis (e.g. currentSelection.transform.Rotate( 0, 0, delta * your_sensibility_factor )).

    Does that help? Let me know if you need more details.
     
  45. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Hi,

    FingesGestures is pretty cool, but something's bugging me. I've set up a global filter for my UI, but objects that use the toolbox scripts stil get events. I could of course ray cast for my UI again, but that seems a bit redundant.

    Are global touch filters meant to ignore the toolbox scripts?
     
  46. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    432
    @SPK : very clear, thanks a lot :D
     
  47. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hm, the toolbox scripts are just an extra layer on top of the base gesture recognizers so they should definitely be affected by the global filters just the same. I will take a closer look at this during the weekend and get back to you.
     
  48. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Erm, it's working now, so it must have been me doing something wrong in my GUI I geuss some missing colliders or something. Sorry! Thanks for the quick response :)
     
  49. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    In case you missed it, FingerGestures is currently featured on the Hot Deals, and you can get it for half its price until September 1st!
     
  50. Krodil

    Krodil

    Joined:
    Jun 30, 2010
    Posts:
    141
    @Spk: thnx a lot for your replies.
    From an overall point I face some troubles atm.

    I need to be able to rotate,scale and drag objects when I have touched an object. This sort of works, but I cannot disable/enable scripts on my objects.
    When I touch the terrain or something I dont want to be affected I should be in 'scene mode' as opposed to 'object mode'.

    Then I need 2 cams. One looking down with a 90 degree look for when Im in 'object mode' and one where I navigate using dragorbit seeing the scene with a 45 degree rotation. The problem is that I need two cameras since I am not allowed to move the cam when DragOrbit script is on.
    But when I shift to the other cam I get errors regarding screenpoint.ray caus I now fire from a different cam.

    Does it make sense? :)