Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

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

  1. ProjectOne

    ProjectOne

    Joined:
    Aug 9, 2010
    Posts:
    442
    Hi, thanks for your reply.
    Yes it was on the actual device, also the object I was dragging is a cube scaled up sideway I think 2 or 3 unity units of scale but it looked like I could only drag the object if I was to touch It in the middle (centre of local transform), trying to grab the object left or right half would not work. Maybe this is how you have it setup? You have to touch the object centre to drag it?
    Cheers
     
  2. parnell

    parnell

    Joined:
    Jan 14, 2009
    Posts:
    206
    ZOMG!
    In 1 day two kits/scripts I've been looking for forever just landed in my lap!
    My question is, can I make the gesture base stuff connect to something else?
    So say the player could try to draw a star on the screen if they draw the star they win.
    Think like Trama Center...is that possible with this?
    Thanks so much!
    B
     
  3. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Nope there's no particular requirement on where you have to press it. I think this is simply due using a one pixel-think raycast and the finger position ending up slightly outside of the target object bounding boxes since fingers aren't exactly as precise as a mouse cursor. Using a thick raycast (such as a Physics.SphereCast) or making the object bounding box bigger would probably solve this issue.
     
  4. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    FingerGestures doesn't currently let you detect custom gestures out-of-the-box. This is a planned addition for future releases.
     
  5. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Hi SPK

    We are looking for some scripts to work with the most common finger gestures on iOS and Android devices.
    Especially to zoom in and zoom out the camera view with "pinch".
    Unfortunately Unity it selfs do not spend such a script collection by default or any sample files..however,
    is your package including an example scene to simply zooming the camera view with "pinching"?
     
  6. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    There is a straightforward FingerGestures sample showing how to use the pinch gesture to scale a rectangle on screen. It can be easily adapted to affect the camera position instead. If you're having problems doing this, I can help out or provide a working script if I find some spare time.
     
  7. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Hi Spk

    Well thanks for your offer, about supporting me.

    I realy need only a script for "pinching" my camera view. I mean, this is one of the most common guesture on a mobile device. And if I purchase Unity for Android for additional 1500 USD, why have I to pay again for stuff which must be included in the default package of UntiyPro..self-evident...

    But OK I would spend you that money, if you add a simple scene with a smooth zooming function with the pinch guesture - but it must work on every Android device with multitouch screen.

    What do you think, have we a deal?
     
  8. Rush-Rage-Games

    Rush-Rage-Games

    Joined:
    Sep 9, 2010
    Posts:
    1,997
    Looks awesome!
     
  9. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Was too late to integrate this into our current project (had built the touch input stuff already), but definitely keeping an eye on this as that code was messy. Looks pretty sweet so far =)
     
  10. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hehe, I'll see if I can wip up something quickly for you tomorrow, and post it here.
     
  11. tobephong

    tobephong

    Joined:
    Oct 2, 2009
    Posts:
    15
    Is there a way I can increase the finger detection rate? I used the OnFingerMove to drag a game object(line trail), but the detection is very lagging. Is there another method or way to increase the detection rate. You plugin is a life saver by the way. Keep the update coming>
     
  12. vonchor

    vonchor

    Joined:
    Jun 30, 2009
    Posts:
    249
    I tried contacting you using the spk@fatalfrog.com on the fatalfrog website but it bounced so I'll try here:
    -----------------------------------------
    I am using your very nice FingerGestures package and I am also using PlayMaker. I made a few minor changes to TBComponent which make for an easy interface to PlayMaker and I'd like to post it on their forum for user code.

    http://hutonggames.com/playmakerforum/index.php?board=19.0

    TBComponent.cs doesn't really "give away" much of FingerGestures.... but if it's a problem I'll just keep this for myself.

    The two packages together are quite a nice combo. Might boost your sales :)

    Seriously, though, FG was really worth the insignificant amount of money you charge for it.

    my email is vonchor@gmail.com if you want to take this off-thread
     
  13. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Sorry for the slow replies, im currently on vacation without much net access. Im typing this from my iphone. I will get back to you all next week.

    @vonchor: this sounds like a great idea! I would just like to review ur changes before giving it a greenlight if u dont mind. Not sure why u got bouncd on my fatalfrog email though. Ill get back to u on monday or tuesday.
     
    Last edited: Aug 20, 2011
  14. oliverdb

    oliverdb

    Joined:
    Jan 30, 2010
    Posts:
    165
    Hey spk

    Awsome tool, but I have an issue. Currently I have several 2D sprite I want to drag around and unfortunatly the collider (mesh collider) is a child object on some of my sprites since I need to scale the mesh down to size and rotate it appropiately.

    This causes TBDrag to complain about missing colliders (its in the child)

    How can I make this work?

    Btw I have the same issue as tobephong, mostely using Mousegestures and drag, at low speed its very "laggy" and I get no response from the mouse.
     
    Last edited: Aug 22, 2011
  15. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    In the TBInputManager.cs, you need to modify the PickComponent() method that does the scene-picking of TBComponent objects. Right now it just looks for the TBComponent in the object it hits, not in its child. Try this instead:

    Code (csharp):
    1.  
    2. T PickComponent<T>( Vector2 screenPos ) where T:TBComponent
    3. {
    4.         GameObject go = PickObject( screenPos );
    5.        
    6.         if( !go )
    7.             return null;
    8.  
    9.         return [COLOR="red"]go.GetComponentInChildren<T>();[/COLOR]
    10. }
    11.  
    You could also combine both. If go.GetComponent() returns null, you could then try to look into its children (even do so recursively if the component is located further down in the hierarchy).

    The OnDragMove and OnMouseMove events only fire after a minimum threshold distance has been traveled since the last event fired. This might be what you guys are experiencing and interpreting as lag. You can lower this threshold in on the TouchScreen Gestures and/or Mouse Gestures prefab objects (moveTreshold and dragTreshold).

    Let me know if this solves your problem, else I will investigate further. FingerGestures refreshes as quickly as Unity allows for it, so it's either a bug in my code or simply some settings that need to be adjusted for your particular scenarios.
     
  16. oliverdb

    oliverdb

    Joined:
    Jan 30, 2010
    Posts:
    165
    Well actually I get a hit on the child and should then look to the parent, something like below works... But its not very fool proof...

    Code (csharp):
    1.  
    2. return go.transform.parent != null ?  go.transform.parent.GetComponent<T>() :go.GetComponent<T>();
    3.  
    4.  
     
  17. Optician

    Optician

    Joined:
    Aug 3, 2011
    Posts:
    4
    Hi,

    I've bought your framework, but when I'm using the drag events, I'm finding that moving my finger slowly does not register an event. Am I doing something wrong? I want to be able to finely track drags, and other events?

    Thanks,

    Chris
     
  18. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Thanks, I've just reproduced this bug on the web demo and it indeed happens when i only move by very small increments.This is apprently the same issue that tobephong and oliverdb reported earlier. I will have this fixed and updated as soon as possible this week.
     
  19. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    HI Spk

    That statement is some weeks old..
    When do you plan to apply such a example for you package?

    >>What it needs: Zooming the view with pinch guesture.
    Dubiously that such a common function for mobile device is not included within the UnityPro Android/iOS package..
     
  20. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    @Optician, oliverdb tobephong: I have identified and fixed the issue with the move/dragMove events not firing properly on very small moves. For some reasons, the move-treshold check was performed every time the finger would go stationary instead of on the initial stationary -> moving state transition only. Thanks for helping pinpoint this issue.

    @visualizer: as I mentioned earlier, this is taking a bit more time because i'm currently on vacations, with limited net/computer access. However, i'm planning to submit a new update with the above fix and I will hopefully have some extra time to add a bunch of new samples, including the camera zoom in out you requested.
     
  21. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    FingerGestures v1.4 is now up and running on the Asset Store!

    TOOLBOX
    * Added TBPinchZoom script for camera zoom in out using the pinch gesture
    * Added TBDragOrbit script for orbiting an object around another using the drag gesture (adaptation of the standard MouseOrbit script)
    * Added Toolbox-PinchZoomCamera and Toolbox-DragOrbitCamera sample scenes to demonstrate the new toolbox scripts above

    BUG FIXES
    * Fixed a bug causing the drag and finger move events to not fire properly when the user performs very small motions
     
  22. onllm

    onllm

    Joined:
    Mar 4, 2011
    Posts:
    111
    wow thx for the timely update
     
  23. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Again

    That Toolbox-PinchZoomCamera must be modified! Because the zoom is jumping and is not smoothly at all!

    So we tried to experiment again hours...:mad:
    ..for example with the Mathf.SmoothDamp function:

    Here the code:

    >Additional declarations at the top of the "TBPinchZoom" script:
    -----------------------------------------------
    public float smoothTime = 0.3f;
    public float zVelocity = 1.0f;
    -----------------------------------------------

    >Original code from "Finger Geusture" (around line 71)
    ----------------
    camera.fov = Mathf.Max( defaultFov - zoomAmount, 0.1f );
    ----------------

    >New code for a smooth zooming:
    ----------------
    //camera.fov = Mathf.Max( defaultFov - zoomAmount, 0.1f );

    Float CamFov = Mathf.Max( defaultFov - zoomAmount, 0.1f );
    camera.fov = Mathf.SmoothDamp(camera.fov, CamFov, zVelocity, smoothTime);
    ------------------

    But it do not works, becuase Unity produces errors, which "non coder freeks" can't handle...

    So please can you Spk this figure out for us as your customer?
    Thanks
     
  24. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    If you want a smoother camera, use this approach:
    - introduce a new public float zoomSmoothingFactor variable (initialize it to 1 for instance)
    - introduce a new private idealZoomAmount variable
    - in the FingerGestures_OnPinch event handler, replace ZoomAmount by idealZoomAmount
    - in the Update() method, do something like this:
    Code (csharp):
    1.  
    2. ZoomAmount = Mathf.Lerp( ZoomAmount, idealZoomAmount, zoomSmoothingFactor * Time.deltaTime );
    3.  
    This should produce a nice smoothing of the changes in ZoomAmount, therefore creating a smooth zoom effect. This is pseudo code, so you'll have to fiddle with it. I'm just posting this here now for your convenience, but please understand that this is already going beyond the scope of what FingerGestures is meant to provide you with: an API to detect common input gestures. The rest is up to you, and I've only provided these extra camera scripts to give you some extra help. I will of course improve them over time if necessary, but they are not the focus of FingerGestures.
     
  25. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Im going to be off the grid for at least a week starting on monday 29th august. You can leave your questions here but I won't be able to answer them until I get back, as I will probably not have internet access until then.
     
  26. rezilausiv

    rezilausiv

    Joined:
    Nov 18, 2010
    Posts:
    126
    Sorry, but there is non "Update() method" in this script >TBPinchZoom.cs!

    As we mentioned: > we will pay for such a "camera pinch zoom script" if it works without spending a lot more time to optimize it.

    We hope now, that if you are back, you will modify that example, so pinch zoom camera is working smoothly and without jumping the view in and out..
    Even if you guess, such an example is an "extra help". But your script collection is named "Finger Guestures" and it makes only sence with robust working examples to simply adapt in our projects.

    Thank you
     
  27. oliverdb

    oliverdb

    Joined:
    Jan 30, 2010
    Posts:
    165
    Hey

    Doing a stacking Game I really want to drag with an offset, so the finger does not cover the gameObject. Any way todo that?
     
  28. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    Hello,

    I just bought this and the pinch zoom is working great, I do have a question.

    I have a camera the looks down on the area when the player selects a map. What I want to do is when the player moves a finger around the screen, the map moves under it. Just like the Apple "maps" app works. What would the best way to do this?

    Thanks,

    I figured it out! I was able to implement both pinch zoom and map scroll with boundaries on one map!

    Thanks,
     
    Last edited: Sep 5, 2011
  29. yvesh

    yvesh

    Joined:
    Apr 2, 2010
    Posts:
    14
    Hi William,
    I'm interested in getting gestures out of Windows 7 with Unity 3.4. I noticed you mention support for gestures in standalone.
    I ran some tests with Input.touches but the touch count always returns 0 and also
    Code (csharp):
    1. Input.multiTouchEnabled  = false
    This leads me to believe multitouch is still not supported in Unity 3.4 Windows.
    Question: In your framework did you write a plug in that intercepts WM_TOUCH events? If yes I'd definitely be interested in purchasing it.
     
    Last edited: Sep 9, 2011
  30. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    this looks like a great buy on the asset store!

    Does this support "Multi-finger Swipe" gestures. For example, a two-finger swipe? or a three finger swipe? We really would need that as core functionality before we can purchase; hopefully its in there already :)
     
  31. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    This will be supported in the upcoming v2.0 version that I plan on releasing within the next 2 weeks. You will be able to specify an arbitrary number of fingers for most of the gestures like drag, swipe, and tap.
     
  32. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    No, my framework doesn't support this at the moment if unity doesn't. You should send this feature request to unity.
     
  33. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    @Spk, thank you for the quick response. We look forward to the multi-finger release, and plan on an immediate purchase as soon as that feature is added. :) Excellent work thus far.
     
  34. MrScary

    MrScary

    Joined:
    Dec 8, 2007
    Posts:
    94
    Just bought this for our project. Wow.. very nice.. love it.. Makes implementing input handlers simple

    I have a question. Is there a way to "reset" the current gesture state? I don't see one. I'll implement it myself if need be, but here's why I need it. I'm handling swipes as well as fingerDown/fingerMove/fingerUp ( in another object ). Well the drag is manipulating a slider control. When I let up, a swipe is getting generated too which is not what I want happening. Any suggestions? Thanks.
     
    Last edited: Sep 12, 2011
  35. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    This isn't possible with the current version, however this is also on my plate for the upcoming 2.0 version. I need this functionality for my own projects too ;) in the meanwhile all you can do is to find out a reliable way to detect these special cases and ignore the correct events...
     
  36. MrScary

    MrScary

    Joined:
    Dec 8, 2007
    Posts:
    94
    I found a reliable way :) Crank FingerGestures.Instance.minSwipeDistance way up while handling finger down, and then restore it to normal in finger up.

    Since we're passed in fingerIndex, it would be nice to have an interface to the actual "finger data" too.

    thanks
     
  37. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hehe, looks like you are reading my mind ;) the next version will expose a ton more data for advanced users to mess with, including the finger data. The current system/api using global events will still be supported for quick use and backward compatibility, but a brand new set of gesture detector classes are going to be exposed too, allowing for a lot more flexibility in configuration and detection of each gesture. This new design will also allow for multiple finger gestures like 2 finger swipes, taps, etc. I've got the core working but I'm still fleshing out some of the details and trimming down the new api to make it as easy and straight forward to use as possible. This should also make the library a lot more open for expansion. For instance, it will be quite easy to creat your own custom gesture detectors.
     
  38. 01iv3r

    01iv3r

    Joined:
    Mar 6, 2011
    Posts:
    17
    Spk: huge thanks for the TBDragOrbit and TBPinchZoom scripts. These are darn handy, though they do not play well together! TBDragOrbit is constantly resetting the distance and seems to be picking up data from what should be the pinch gesture :(

    Any chance of mimicking something like => http://www.youtube.com/watch?v=OouBzirUZww&feature=related in a TB script?

    Also, two finger panning ala iRhino3D would be sweeet! :D
     
    Last edited: Sep 13, 2011
  39. davebuchhofer

    davebuchhofer

    Joined:
    Nov 9, 2007
    Posts:
    126
  40. pion

    pion

    Joined:
    Jul 7, 2011
    Posts:
    27
    I've just bought FingerGestures. I am trying to use the TBTap using C#. I've defined my delegate method as the following:

    The OnTap() method is called correctly.

    How do I access the finger index (fingerIndex) and finger position (fingerPos) ?

    Thanks in advance for your help.

    ANSWER:
    After looking at the TBInputManager.cs and TBTap.cs, I think I found the answer by doing the following:

    Please let me know if there is a better way.
     
    Last edited: Sep 14, 2011
  41. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    You did this the right way ;)

    Edit: quick correction: you might want to use GetComponent() instead of GetComponentInChildren(), depending on where the TBTap script is located relative to ur own script.
     
    Last edited: Sep 14, 2011
  42. 01iv3r

    01iv3r

    Joined:
    Mar 6, 2011
    Posts:
    17
    Dave: that's awesome! How is it going?.. I'm pretty to Unity and taking the JavaScript approach, so am a bit lost with the included C# TB scripts. Heck I'm stll a bit lost even with the standard MouseOrbit.js. Still trying to get my head around what's happening with Quaternion's and multiplying Vector3's.
     
  43. davebuchhofer

    davebuchhofer

    Joined:
    Nov 9, 2007
    Posts:
    126
    Here's something that mostly-works for (1 touch) orbit / (2 touch) pan / (pinch to) zoom, needs a bit of tweaking at some point, working out the hierarchy to allow position zoom, along with a couple other strange things i was experimenting with when the scripts were on separate cameras.

    Some small things i'd like to be able to do (or know how to do if they're already in there):

    How can i see how many touches there are? (something generic that works with mouse and touch would be nice?)
    or maybe just an addition to the MouseGestures.cs something that can tell if theres more than 1 mouse button pushed,

    as of now, i'm just using the Input.touchCount, which works fine for iOS, but breaks the scripts for standalone and editor use (sadface)

    need to work it out to be a bit more robust, and add in a mouselook also.

    Just touching the surface of the system so far and I like it
     

    Attached Files:

  44. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    cant wait for multi-finger swipe/touch ;-)
     
  45. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Question, is the upcoming v2.0 free upgrade for existing user or not?
     
  46. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Yes. I'm not sure yet if I'm going to bump the price of the package up a last time though, but this won't affect existing users.
     
  47. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Lower the price by $10 bucks and you got a sale :D
     
  48. MrScary

    MrScary

    Joined:
    Dec 8, 2007
    Posts:
    94
    I think it's priced just about right :p After buying FingerGestures, getting it integrated into our game in about 30 minutes and realizing how much time it has saved me, it's worth what I paid and more. I wouldn't let $10 hold you up from picking it up. I think it would work well with just about any kind of game too. I like the fact that I can subscribe to input callbacks easily from any of my code. Game code, menu code, in-game tool code. It all worked without me having to mess with anything or reinvent the wheel.
     
  49. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    we just purchased, but wont get much use out of Finger Gestures until MULTI-FINGER SUPPORT IS ADDED. once we can do some 2 and 3 finger swipes, then we're in business. Cant wait for the new update @Spk. great work on this tool thus far :)
     
  50. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    I'm hard at work on it, I'll probably be able to release something next week.