Search Unity

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

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

  1. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hey Spk,

    I have some confusion when detecting a swipe (indeed what makes a swipe different to a drag).
    Anyway, in my app you touch the screen to move to that point. But I need to know if the touch is just a touch (maybe a drag) or a swipe.
    I might be approaching this incorrectly (you don't say!).
    But how do I detect if a touch has become a drag or a touch has become a swipe :-<
    I'm trying to get the direction of swipe i.e. not just up/down/left/right.

    Cheers
     
    Last edited: Oct 27, 2011
  2. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    The swipe is simply a convenience gesture recognizer. In essence, it's a drag gesture constrained to the 4 cardinal directions, and it only fires the event when the user has lifted his finger AND the swipe criteria have been met (e.g.g minimum swipe distance and speed).

    What you seem to really be after is detecting a finger motion from the user, so if I were you I'd just stick with the drag gesture recognizer.

    In general, you can check if a specific gesture has been recognized by querying a GestureRecognizer's State property. The State will tell you the current gesture recognition state (waiting for input, in progress, recognized...). If you are using the default GestureRecognizers, you can access for instance access the default drag gesture state property via FingerGestures.Defaults.Drag.State.

    Does that help?
     
  3. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hi Spk,

    Just been reading the whole thread and came to the conclusion that a swipe is a nice drag :)
    Not quite sure what you are saying having re-read it a few times... <I must be doh>
    I haven't upgraded to v2 yet; so that might be an issue and why I am looking <blank> :))

    Cheers
     
  4. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Ah yep, i'm talking about v2.0+ stuff here - you have to keep up with the changing times markhula! :p
    There have been massive changes in v2.0 which gives you more control and information over the various gestures.
     
  5. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    LOL! :)
    Ok, I shall now upgrade to 2.0.
    But I'm still unsure exactly what I need to do to detect a drag(swipe in reality) from a touch

    Cheers
     
  6. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    I'm not quite sure I understand your problem - What's wrong with simply using the drag gesture events? Simply subscribe to the OnDragBegin, OnDragMove and OnDragEnd events, and you will be notified whenever a drag gesture has been performed by the user.
     
  7. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hi Spk,

    I'm probably confusing myself :)
    At the moment can't seem to upgrade to v2 anyway. If I download and then import from asset store I seem to get v1.4 imported again; even though I deleted it from the hierarchy ....


    Cheers
     
  8. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hm I've been hearing that from other people too... Can you try to import it in a new blank project, and see what you get?
     
  9. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hi again Spk,

    Yep; in a new project it does the same.
    The Asset store import shows all the files as 'new' (so I assume are v2) and then just select import - but I always get v1.4 back !!!
    How did everyone else upgrade? (I hate upgrading it always breaks things!! :-((( )
    Can you help or is it up to Unity to fix?

    Cheers
     
  10. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Nah, can't import it at all :-(((((((((((((
     
  11. nemo_uk

    nemo_uk

    Joined:
    Oct 27, 2011
    Posts:
    3
    Thanks very much for 2.1 update.

    The new drag orbit camera script is just what I'm after, now all I have to do figure out how to pan the camera using a two finger swipe,just like the Autodesk 123D Sculpt app.
     
  12. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hey nemo_uk,

    How did you manage to upgrade???

    Cheers
     
  13. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Ok; got it imported I think!!!

    Really, really simple thing!
    You need to be logged into the asset store :) ; if you're not, there's no error, no warning no nothing - just doesn't work (even though it looks like it is working).
    Humph! :)

    Cheers all
     
  14. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    You could make a separate script that subscribes and react to FingerGestures.OnTwoFingerDragMove event and translates the game object along its transform.right and transform.up vectors based on the move delta's x and y amounts. Then you'd just need to attach this script to your camera and you'd be set ;)
     
    Last edited: Oct 27, 2011
  15. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    FingerGestures v2.1.2 is now live, and can be installed using Unity v3.2+:
    - Fixed bug that would prevent DragGestureRecognizer from detecting very small finger motions
    - Tweaked some of the toolbox orbit camera settings to make it more user-friendly
    - Updated some of the installation and setup instructions
     
  16. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    thank you for the new updates @Spk
    FingerGestures is such a great tool! :)
     
  17. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,125
    Hi! I'm thinking of buying this. do tell me- will the Swipe feature also give me the speed/direction of the swipe- for example for launching an object?
     
  18. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Yes it does - if you check the documentation page for the swipe gesture recognizer, you will see that the class exposes the following properties:
    - Direction: Get the swipe direction detected
    - Move: Get the total move from start position to last/current position
    - Velocity: Get the current swipe velocity (in screen units per second)

    If you use the default swipe gesture event, (FingerGestures.OnSwipe or FingerGestures.OnFingerSwipe), you will also get these values via the event handler arguments.
     
  19. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hey Spk,

    I'm still having some issues distinguishing between a swipe (using drag) and a 'touch'
    Here's what I do:

    if (player.mode_state == PlayerActions.mode.carrying)
    {
    if (touchController.Fingers[0].action == finger_modes.FingerDragBegin player.throw_in_progress == false)
    {
    throw_start = touchController.Fingers[0].pos;
    }

    if (touchController.Fingers[0].action == finger_modes.FingerDragEnd)
    {
    player.throw_in_progress = false;
    throw_end = touchController.Fingers[0].pos;
    float angle = (Mathf.Atan2(throw_start.y-throw_end.y, throw_start.x-throw_end.x)*Mathf.Rad2Deg)+180.0f;
    print("SWIPE:"+angle+" "+touchController.Fingers[0].delta);

    touchController.Fingers[0].action = finger_modes.FingerNULL;

    player.moving.transform.parent = null;
    }
    }

    if (player.state == PlayerActions.status.target)
    Moving();
    else
    //Moving
    if (touchController.Fingers[0].action == finger_modes.FingerDown||
    touchController.Fingers[0].action == finger_modes.FingerMoveBegin ||
    touchController.Fingers[0].action == finger_modes.FingerMove)
    {
    Moving();
    }

    Essentially I guess a swipe (really a drag); I need to ascertain the direction, speed and 'length' of drag. I assume this is the correct approach to distinguish between a drag and a 'touch' i.e. finger down.
    The thing is I touch the screen and move around for my character controller to follow; but equally I wish a 'swipe' to be detected; but of course that's very similar to a drag which controls the move.

    Hmmmm, now I written that I may have answered my own question! :))

    Cheers
     
    Last edited: Oct 31, 2011
  20. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Hm this looks a bit confusing - Could you tell me what you're trying to achieve, in term of high-level gameplay?

    It seems you're kind of working around the event-driven design of FingerGestures. From what I can tell, you are using your own data structure to cache touch input data generated by FingerGestures in order to detect when a certain event happens or not. Why not simply leverage FingerGesture's event directly instead?

    To detect a touch, listen to FingerGestures.OnFingerDown event.
    To detect a swipe, listen to FingerGestures.OnFingerSwipe or FingerGestures.OnSwipe event.

    You must be very clear on what you're trying to achieve here. Are you trying to detect a touch (as in, be notified when the finger is touching the screen for the first time) or a tap (= be notified when the finger is pressed, then lifted up again without moving). The OnFingerDown event is the very first event you will receive before any other finger gesture event is fired, because gestures require at least one finger to be down at some point.
     
  21. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hi Spk,

    I cache the results because I assumed (cough) that might be better i.e. I may need to look at them later - it made sense at the time. :). Also some gestures will have multiple uses depending on the characters context, so it just seemed simpler to cache them and read what I want depending on what state the character is in.
    I can't use the built in swipe; because I need 360degs ; not just carinal directions.
    What I am trying to achieve is:

    Player touches screen (no release) and can drag their finger around and the character follows (i.e. calls to the moving() func).
    Player also potentially touches screen and 'drags' quickly in a direction; resulting in a throw of carried object in that direction.
    So I need to make a distinction between (for give the vague wording) a touch and move and a touch and drag (quickly I guess) resulting in a throw.
    Forgive the junk code :)))

    Cheers
     
    Last edited: Oct 31, 2011
  22. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    If you need unconstrained direction, then the drag gesture is definitely the way to go.

    To calculate the swipe speed, you simply need to remember the drag gesture starting point (given to you by OnDragStart) and starting time, and divide the distance traveled by the time elapsed in OnDragMove. This will give you the current average drag speed. You can also take a look at the SwipeGestureRecognizer code for an exemple on how to do this.

    However, what you are trying to do is going to be inherently tricky to get right because the input gestures you want to use are very difficult to detect separately. You should maybe think about using a two-finger gesture for the throw, and a single finger gesture for the character move, for instance.
     
  23. SpaceAndDream

    SpaceAndDream

    Joined:
    Dec 3, 2009
    Posts:
    14
    Hi! Thanks for this great timesaver.

    Although in general it seems to work just fine, I've found one bug (feature? ;-) , which would be great if it could be fixed.

    When you create objects with the TBDrag component (perfect example is Toolbox-DragDrop sample), if you click/select draggable objects, and start to move them, their center will "snap" to the cursor. This is annoying in my case, since I want to do a 2D map/plan that can be moved around.

    Any chance this issue could be solved>?

    Thanks in advance.
     
  24. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    @SpaceAndDream: sure, I'll look into that.
     
  25. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hey Spk,

    Just to let you know; I've just about got walk and swipe (throw in my case :) ) all working with just 1 finger.
    It's not nice code; and yes it was rather tricky - just tried on a real device and it was quite sweet :)
    I'm trying to get behaviour similar to NDS stuff; it's starting too feel good - thanks for all your help!!
    Still got an issue with mouse gestures between scene's. Now in the latest version of fingerGesture a held press across scene's is ignored i.e. on the next scene I must release the press and then apply again. Will try and sort out that testbed scene for you. :))
    FingerGestures was a great purchase; if anyone is in doubt I suggest you go for it!

    Cheers
     
  26. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    @markhula: good to hear, and thanks for the kind words! ;)
     
  27. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Hi William, got some time to dive into the package. I really liked your examples of whats possible!

    I am wanting to have 4 panels (surrounding the screen) that can be brought in when the player does a two finger swipe in the proper direction. Based on watching the vid and looking at the samples, I have implemented that using the advanced method. So far so good. Now that the panel is out and in view, i would now like to hide it again so I thought it might be easier to just use a TBSwipe script on each panel object itself in order to trigger the hide. While i would like to use a two finger swipe to hide, i started with a single swipe as I haven't figured out how to get the toolbox version to do a two figure gesture yet.

    What I am seeing is that the swipe up that shows up via a debug.log fires wether the swipe is done on the panel object or not. My understanding @ this point was that the TB stuff only fired on a valid collider found on an object that had a TBClass script on it?

    My RageSpline panel object has a MeshCollider enabled on it.

    iByte

    Update: ... Hmm TBSwipe went from firing every time to not at all now. The two finger SwipeGestureRecognizer still working though. So I have something misconfigured somewhere.
     
    Last edited: Nov 5, 2011
  28. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    I took the toolbox scripts out of the equation for now. This is the code I am using below but I am finding that the RayCast is testing positive intermittently when I am over a panel.

    Edit: I have tried both box and Meshcolliders with the same issue. Using Debg.Ray I can clearly see where the Ray is going through the collider.

    Final update: I was trying to use RagSplines automatic Box or Mesh Colliders but it just was not working. By adding the basic box collider component to the RagSpline objects I was getting a hit every time.

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class PanelSlideController: MonoBehaviour {
    5.  
    6.     public Camera raycastCamera;            // which camera to fire the raycats through. If set to null, this will default to the main camera
    7.     public LayerMask ignoreLayers = 0;      // layers to ignore when doing the pick raycasts
    8.  
    9.     public SwipeGestureRecognizer swipeGesture;
    10.     public GameObject bottomPanel;
    11.     public GameObject topPanel;
    12.     public GameObject leftPanel;
    13.     public GameObject rightPanel;
    14.     private GameObject selectedPanel;
    15.    
    16.     // Movement codes
    17.     // 1 open bottom panel
    18.     // 2 open top panel
    19.     // 3 open left panel
    20.     // 4 open right panel
    21.    
    22.     GameObject target;
    23.     int movement;
    24.    
    25.     // Use this for initialization
    26.     void OnEnable () {
    27.         swipeGesture.OnSwipe += swipeGesture_OnSwipe;
    28.     }
    29.    
    30.    
    31.     void swipeGesture_OnSwipe (SwipeGestureRecognizer source) {
    32.    
    33.         Debug.Log("Swipe in direction " + source.Direction + " and starting Position " + source.StartPosition);
    34.        
    35.         movement = 0;
    36.         if ((target = PickObject(source.StartPosition)) == null) {
    37.        
    38.             //No GameObject over the swipe start position so we bring the panel in
    39.             if (source.Direction == FingerGestures.SwipeDirection.Up  source.StartPosition.y < Screen.height/2 ) { movement = 1; selectedPanel = bottomPanel; }
    40.             if (source.Direction == FingerGestures.SwipeDirection.Down  source.StartPosition.y > Screen.height/2) { movement = 2; selectedPanel = topPanel; }
    41.             if (source.Direction == FingerGestures.SwipeDirection.Right  source.StartPosition.x < Screen.width/2 ) { movement = 3; selectedPanel = leftPanel; }
    42.             if (source.Direction == FingerGestures.SwipeDirection.Left  source.StartPosition.x > Screen.width/2) { movement = 4; selectedPanel = rightPanel; }
    43.        
    44.             if (movement > 0 ) selectedPanel.SendMessage("openPanel", movement);
    45.         } else {
    46.             // The swipe was made over a panel so this is where we will deteemine what to do later to open the panel further or close it
    47.             Debug.Log("Were swiping on this " + target);
    48.         }
    49.        
    50.     }
    51.    
    52.  
    53.        // Return the GameObject at the given screen position, or null if no valid object was found
    54.     GameObject PickObject( Vector2 screenPos )
    55.     {
    56.         Ray ray = raycastCamera.ScreenPointToRay( screenPos );
    57.         RaycastHit hit;
    58.  
    59.         if( Physics.Raycast( ray, out hit, float.MaxValue, ~ignoreLayers ) )
    60.             return hit.collider.gameObject;
    61.  
    62.         return null;
    63.     }
    64.  
    65.     void OnDisable () {
    66.         swipeGesture.OnSwipe -= swipeGesture_OnSwipe;
    67.     }
    68.              
    69.                  
    70.     // Update is called once per frame
    71.     void Update () {
    72.    
    73.     }
    74. }
    75.  
     
    Last edited: Nov 5, 2011
  29. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    @iByte: I'll take a look at this tomorrow (sunday) and get back to you.
     
  30. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Hi, I have my panels responding the way I want with finger swipes now, opening and closing properly. I have started to move my Ez GUI controls onto these but I am finding that EZ GUI is still picking up the first finger of a two finger swipe while the panel is open. (Which makes sense)

    I am thinking some kind input chain needs to be created as there will 3 layers of (possibly) overlapping controls/objects that need to respond to input.

    Get input
    If registered finger gesture then process
    else if EZ GUI control then process
    else pass to game input queue

    So I am not quite shure how to approach this yet and would expect other devs to have similar design issues. Anyone else figured out a working approach to this?
     
  31. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    You could look into the GestureRecognizer.SetCanBeginDelegate() method, as this will allow you to provide a custom delegate to control whether a gesture recognizer should start handling the current gesture or not.

    But I agree that a higher level / more general solution would be preferable to this. I'll give this some thoughts, but if you have any suggestions/preferences, fire away ;)
     
  32. SpaceAndDream

    SpaceAndDream

    Joined:
    Dec 3, 2009
    Posts:
    14
    Hi William,

    Did you have time to look into this issue I pointed out^?

    G
     
  33. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    No I'm sorry, haven't had the time. I'll look at it this week though. In the meanwhile, if you want to experiment by yourself, you need to change the dragging code in TBInputManager so that it translates the dragged object by an offset instead of directly setting its position to the drag gesture's last position. This offset is the total drag motion (dragEndPos - dragStartPos).
     
  34. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Hi Spk.

    We're having a problem since V 2.0. Now there is a Max Duration for "Default Tap", and it seems to control both the max tap duration AND the MINIMUM amount of time between taps. In other words, I want to be able to say the max duration for a tap is .25 seconds, but I want to be able to tap more than 4 times a second. It seems to be a single parameter right now. Is there any way to do what I want with the current code? I just upgraded today to the latest. Taps more often than my setting there do not register or fire...

    This did not happen before V 2.0 to the best of my knowledge.

    Thanks!
     
  35. XxPleYxX

    XxPleYxX

    Joined:
    Jul 26, 2011
    Posts:
    41
    Hi William,

    When is planned release of version 2.2 with custom gesture recognition?
     
  36. Bugfoot

    Bugfoot

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

    Looks like one of these things that got "lost in translation" ;) I'm taking another pass at the TapGestureRecognizer to bring some improvements. I want to replace the MaxDuration property by a MaxDelayBetweenTaps one instead, which makes more sense. Also adding a few more properties to control when the OnTap event should be fired. That should address your problem.

    I'm planning on releasing an update later this week, with a couple of tweaks and bug fixes that the various posters above have pointed out.
     
  37. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    No ETA yet, sorry.
     
  38. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hey there all,

    Does FingerGesture play nicely with UIToolkit?
    By that I mean UIToolkit already has some input stuff built in; is it ok to 'mix 'n' match' both??

    Cheers
     
  39. mattSydney

    mattSydney

    Joined:
    Nov 10, 2011
    Posts:
    171
    Hi finger gestures is great!

    I am using the drag object , which works fine until the camera position moves , then the object seems to drag in the z direction instead if x and y, and disappears of screen. Is there a way of fixing this , for example , imagine if u had a hand on screen that u could drag around and when the camera changed position or rotation it still worked the same?
     
  40. Bugfoot

    Bugfoot

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

    At the moment, the drag plane types supported are either the absolute XY, XZ, or YZ plane, or you can also provide a custom collider to project your dragged objects on. However, it's indeed missing a "drag along the current camera's plane" (which is what you're after). Since I was already working on some improvements to the toolbox drag system, I've also added a DragPlaneType.Camera option, which will always drag your objects along a plane parallel to the camera. I've set this as the default, since that's what you would want most of the time anyways.

    I'm not sure why I didn't start with this method the first time around, but it's now supported anyway ;) This will be included in the next update, which should be up in the next few days.
     
    Last edited: Nov 10, 2011
  41. Bugfoot

    Bugfoot

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

    I haven't tried, but I don't forsee any problems. Give it a try and let me know ;)
     
  42. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hey Spk,

    I *think* it works!. UIToolkit seems to have some bugs that cause other issues. But I must admit I am using finger gesture for 'world' touches and uitoolkit for 2d icon stuff and seems good.

    Cheers
     
  43. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Quick follow up on this: I've made some tweaks and additions to the TapGestureRecognizer class, including the ability to individually set MaxDelayBetweenTaps (maximum amount of time that can elapse between two consecutive taps) and MaxDuration (overal gesture duration limit). These changes will be included in the next update.
     
  44. mattSydney

    mattSydney

    Joined:
    Nov 10, 2011
    Posts:
    171
    Awesome I'll keep my eye on the unity store for the update :D
     
  45. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
    Hi William; small feature request.

    -> Please make Finger Gestures not puke out if recompiling project while Play is active (presumes MakePersistent is enabled)

    One of the joys of Unity is that we can recompile on the fly in many situations; and I'd rather not have Finger Gestures be another one of the exceptions.

    Adding, had modified a prior version of Finger Gestures to support this, so it is possible. Changes included moving some of the init to OnEnable from Awake, but I'd rather not do this with every version update! (plus I forget all that it entailed, and don't want to have to remember it) haha :)

    Thanks again for the very cool plugin! :)
     
  46. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
    Sorry, it was too frustrating so went ahead and made these changes to enable recompiling on the fly when using FingerGestures:

    FingerGestures.cs
    change:
    Code (csharp):
    1. protected virtual void Awake()
    to:
    Code (csharp):
    1. protected virtual void OnEnable()
    change (note: found in InitFingers()):
    Code (csharp):
    1. fingers = new Finger[count];
    to:
    Code (csharp):
    1. if ( fingers == null )
    2.     fingers = new Finger[count];
    3.  
    change (note, should never try to destroy a transform implicitly, always use the GameObject instead):
    Code (csharp):
    1. Destroy( globalComponentNode );
    to:
    Code (csharp):
    1. Destroy( globalComponentNode.gameObject );
    change (note, should never try to destroy a transform implicitly, always use the GameObject instead):
    Code (csharp):
    1. Destroy( fingerCompNode );
    to:
    Code (csharp):
    1. Destroy( fingerCompNode.gameObject );
    With that, FingerGestures should work fine if recompiling during Play mode (ensure MakePersistent is enabled on Finger Gestures Initializer) :)

    Consider to include in next FingerGestures update? ;)
     
  47. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    Thanks Joe, I'll add your changes to the next update ;)
     
  48. se7en

    se7en

    Joined:
    Dec 3, 2008
    Posts:
    232
    Hey spk! I just picked up a copy of FG - very cool stuff. Just FYI in your javascript example, you are using a .cs script : )

    It took me a bit to figure out how to connect the C# class to my .js file because its on a prefab. Lots of errors!! Until I added...

    var FG : FingerGestures;

    ...and then updated the enabled/disabled event code. Anyway I am all setup and ready to go!

    Will being event driven offer better performance than native code in an update loop or will it be more responsive? What is the tradeoff do you think? My old code was very fast, in the update loop, but used to drop a lot of touches, have premature ends, etc. Basically the events were fairly glitchy.

    For future feature requests I would love to see basic symbol gesture recognition like Infinity Blade - draw an X, a circle, an open arrow, etc. I think this would be pretty useful. Anyway, great stuff so far. I'm looking forward to diving into FG a bit more soon!

    shay
     
  49. Bugfoot

    Bugfoot

    Joined:
    Jan 9, 2009
    Posts:
    533
    se7en: could you tell me which file(s) you are referring to please? This sounds very odd...

    The event driven approach offers the best performance possible as it only fires when something happens. You don't have to poll for it in each of your modules you want to use FG in. The events fire during the same frame that the actual input was detected, so it's as close to the wire as it can be.

    As for the custom gesture recognition: I've got this on my roadmap, and it seems quite a few people have been asking for it, so I'll start looking into it soon (tm) ;)
     
  50. Vern_Shurtz

    Vern_Shurtz

    Joined:
    Mar 6, 2009
    Posts:
    264
    I have a question for the Developer or Users of FingerGesture. Is FingerGesture compatible with the Win7 touchscreen input support added in Unity 3.4?
    I have an ACER T231H monitor on order that I will be using to display some product demo's on that I am creating in Unity and would like to use FingerGestures.

    TIA
     
    Last edited: Nov 14, 2011