Search Unity

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

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

  1. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    Most of the toolbox scripts already do that for you. For instance, the TBDrag script stores the FingerIndex, FingerPos and MoveDelta of the latest drag event generated. So when you receive the event notification in your own script (assuming you went for the "send message" approach), you just need to get a reference to the TBDrag script that called this message and access the properties I listed above.

    While reviewing the code though, I noticed that I chose to not include a parameter in the event message (look at the TBComponent.Send() base class method). This was for simplicity sake, but you could modify it to pass a reference to the TBDrag (or TBComponent base class) object that generated the message. With this modification, your event message/callback function signature could look like:
    Code (csharp):
    1. function OnDrag(sender : TBComponent)
    2. {
    3.   TBDrag drag = (TBDrag)sender;
    4.   Debug.Log( drag.FingerPosition );
    5. }
    6.  
    Does that help?
     
  2. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    It only supports one at the moment. If you need to change it at runtime, simply update the TBInputManager.raycastCamera property. May I ask why you need more than one?
     
  3. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,072
    It's not faulty, it works just fine on my desktop and clicking things within the Unity editor. Just not in game mode. I have default settings as well. Not sure if I want to screw around with this if it doesn't work as is. I'm behind schedule already for my game. I'll probably just take it back and perhaps later buy another one and spend some time getting it to work.

    I can move the mouse pointer just fine with the trackpad, but the tap events aren't working.
     
  4. markhula

    markhula

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

    Hope you are well.
    I have an issue but I'm not sure if it's finger gesture/unity or just iOS.
    Basically as my frame rate drops i.e. I frame out I find 'touches' being missed; most noticeable is a double tap.
    I assume this is because the touch code isn't running at 60fps irrespective of the actual frame rate.
    Am I right or just horribly wrong? :)

    Cheers
     
  5. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    FingerGestures has some code in place to account for missed inputs/invalid finger state transitions that are possible to detect. However, I think there are some cases where Unity will simply miss an input event due to low system performances, and i'm afraid there's not much I can do about it. What are your FPS at?
     
  6. markhula

    markhula

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

    I thought as much. Well I can drop to 30/40 fps from 60 and suffer :-(

    Cheers
     
  7. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    Hm that shouldn't be severe enough to make you lose some inputs. something else must be off. I've done some changes to the tap gesture code with the last update, I could could have sneaked into it... Can you describe a bit better what's happening?
     
  8. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Ok :)
    In the editor it's all fine (hence why I assumed a frame rate issue).
    On the device it would *seem* that the 2nd tap of a double tap sometimes gets missed.
    It's difficult to isolate because it's only on the device and intermittent.
    Sorry, that's probably not very helpful :)

    Cheers
     
  9. kevdotbadger

    kevdotbadger

    Joined:
    Sep 13, 2011
    Posts:
    82
    I want my users to be able to write characters on the screen. Could i use this? Is that already implemented? Could this recognise if a user has wrote "G" on the screen?
     
  10. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    Not yet, but it's in the oven ;) That's the next big feature I plan on adding to FingerGestures.
     
  11. kevdotbadger

    kevdotbadger

    Joined:
    Sep 13, 2011
    Posts:
    82
    As soon as that gets implemented I'll be purchasing, no doubt! I know this is a common question, but have you got any timescales on this?
     
  12. Krodil

    Krodil

    Joined:
    Jun 30, 2010
    Posts:
    141
    how would you do that? my coding skills lack a it. :)

    Sure you may ask. Im making a little app where you can design an area, but I would like to be able to move objects in a 90degree tilt cam AND from a 3degree tilt. Not at the same time, but it should change when a user clicks a button.
    Any help on this? :)
     
  13. nathanc

    nathanc

    Joined:
    May 2, 2009
    Posts:
    6
    Hi Spk,

    I recently purchased your Unity3D asset FingerGestures, which has been a great help with my Unity3D dev projects.

    I'm currently using TBFingerDown TBFingerUp for tracking button interactions such as "OnPress" and "OnRelease".
    However I'm a little stuck as to how to track when a user presses a button, then drags their finger outside of the button collider/boundary before releasing their finger from the screen eg "OnDragOut"

    I'm not too sure how I'm supposed to go about this. Should I be looking at using OnFingerMoveBegin, OnFingerMove and OnFingerMoveEnd or OnFingerDragBegin, OnFingerDragMove and OnFingerDragEnd?

    I'm quite new to using C# and i'm finding it a little confusing, any help would be greatly appreciated.

    thanks,
    Nathan
     
  14. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    Hi Nathan,

    The "toolbox" scripts will be too limited to do what you want, and trying to use the gesture events might be a bit tricky due to the order in which they fire (OnFingerUp will fire before OnDragEnd). I think you'll be better off implementing a custom solution using the Finger data directly. Here's some pseudo-code to get you on the right track:

    Code (csharp):
    1. GameObject pressedElement;
    2.  
    3.     void Update()
    4.     {
    5.         FingerGestures.Finger finger = FingerGestures.GetFinger( 0 );
    6.  
    7.         // the finger is held down
    8.         if( finger.IsDown )
    9.         {
    10.             // the finger wasn't down the previous frame
    11.             if( !finger.WasDown )
    12.             {
    13.                 // check if we pressed something of interest under the finger
    14.                 pressedElement = RaycastUIElement( finger.Position ); // should return null if nothing was hit
    15.  
    16.                 // tell this element it just got pressed!
    17.                 if( pressedElement )
    18.                     uiElement.SendMessage( "OnPress" );
    19.             }
    20.             else // the finger was already down the previous frame
    21.             {
    22.                 // here you can track if the finger is moving (for drag  drop events)
    23.  
    24.                 // check how far we've moved from our initial position
    25.                 if( finger.DistanceFromStart > dragDistance )
    26.                 {
    27.                     // the finger moved beyond our drag treshold
    28.                     dragging = true;
    29.                 }
    30.  
    31.                 // you can use finger.DeltaPosition to get the movement performed by the finger since last frame
    32.                 if( finger.DeltaPosition.sqrMagnitude > 0 )
    33.                 {
    34.                     // here would be a good place to send a "Drag Move" event to the pressed UI control
    35.                 }
    36.             }
    37.         }
    38.         else
    39.         {
    40.             // we just lifted the finger during this frame
    41.             if( finger.WasDown )
    42.             {
    43.                 // check what ui element was under the finger during the previous frame
    44.                 GameObject uiElement = RaycastUIElement( finger.PreviousPosition );
    45.  
    46.                 // if we're still above the same control, send the OnRelease event
    47.                 if( uiElement )
    48.                 {
    49.                     if( uiElement == pressedElement )
    50.                     {
    51.                         pressedElement.SendMessage( "OnRelease" );
    52.                     }
    53.                     else if( dragging )
    54.                     {
    55.                         // drop our original uiElement on the new one
    56.                         uiElement.SendMessage( "OnDrop", pressedElement );
    57.                     }
    58.                 }
    59.             }
    60.         }
    61.     }
    Basically, we make a custom script that tracks the state of the first finger, and fires off various UI events to the affected UI element objects.

    The RaycastUIElement() code is not provided, but it's very similar to what the TBInputManager code does. It should simply send a raycast into your scene from a given screen position and return the first element it has hit, or null if it didn't hit anything or if the object was invalid (e.g. not a UI element).

    I did this a bit quick and late, so let me know if you have more questions or if this is enough to get you going.
     
  15. Krodil

    Krodil

    Joined:
    Jun 30, 2010
    Posts:
    141
    @Spk: specifically I need a way of assigning another cam to the InputManager. When I launch it is maincam, but thorugh a button I wish to jump between maincam and a cam I have caled TopCam. C# is not my thing :)
     
  16. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    Oh then it's pretty easy... just change the InputManager.raycastCamera property to point to your TopCam camera instead, and the rest should work.

    To illustrate this a bit further, let's pretend you have a custom script "MyScript" with a method "OnButtonClick" that is called when your button press event. This script needs to be given a reference to the TBInputManager, the main camera, and your topCamera so it can do the switch. You could simply expose these as public property fields on your script:

    Code (csharp):
    1. public class MyScript : MonoBehaviour
    2. {
    3.     public TBInputManager inputMgr;
    4.     public Camera mainCamera;
    5.     public Camera topCamera;
    6.  
    7.     void OnButtonClick()
    8.     {
    9.        if( inputMgr.raycastCamera == mainCamera )
    10.           inputMgr.raycastCamera = topCamera;
    11.        else
    12.           inputMgr.raycastCamera = mainCamera;
    13.     }
    14. }
    Something like that :) Let me know if you need more help with this.
     
  17. Krodil

    Krodil

    Joined:
    Jun 30, 2010
    Posts:
    141
    uhh. now we are talking! my next 'face-to-wall' moment happened when I tried accessing the OnBUttonClick method from my JS GUI script. I first tried this
    Code (csharp):
    1. GameObject.Find(this).rayCastCamSwitch.getComponent("OnButtonClick")();
    then I found this link: http://www.41post.com/1935/programming/unity3d-js-cs-or-cs-js-access

    but little did it help. The code from the web brings errors on my variable declaration.(I have exchanged the CSharp1 with my script name)

    The problem is that I am royally lost in C#, and all I need is to click on a button, which switches between two cameras.
    I dont quite know how I will manage the drag planes, when the camera angle changes, maybe enable a new InputManager.
    Thnx so far, but this c# is a nut! And if I asked you to do it in JS, the problem about communicating with the C# scripts would still exist...
    Krodil
     
  18. nathanc

    nathanc

    Joined:
    May 2, 2009
    Posts:
    6
    @Spk thanks heaps for the pseudo-code, it's definitely got me on the right track now.
     
  19. soofaloofa

    soofaloofa

    Joined:
    Nov 18, 2011
    Posts:
    26
    Yes, that works great, Thank You!
     
  20. TheGeoff

    TheGeoff

    Joined:
    May 25, 2010
    Posts:
    13
    I'm trying to use the Swipe Gesture in my scene. The swipe event is fired only once for each direction. Do I need to reset the Swipe Recognizer after receiving a swipe event or something like that?

    Thanks,
    Geoff
     
  21. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    Great tool.
    Only one question: Are you considering PayPal as a payment option?
    Thanks in advance for your answer.
     
  22. patch24

    patch24

    Joined:
    Mar 29, 2009
    Posts:
    120
    I keep getting this warning:

    Correcting bad FingerPhase transition (FingerPhase.Began skipped) I think it might have something to do with problems I'm having getting my finger up and finger down calls registering properly. Can you give any details what the error means?

    thanks
     
  23. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    It means that FingerGestures didn't get a Touch with the "Began" phase from the engine before receiving a touch in "Moved" phase. I've seen this happen in low performance situations, and/or when using unity remote. Can you give me some more info on what hardware/platform you're running on?
     
  24. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    I've had quite a few requests about this, so I'm going to start looking into it. I'm a bit worried about the VAT handling part though, but hopefully that's something I can get automated...
     
  25. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    Sorry for the late reply, I had written a full answer a couple hours ago but my internet when kaboom precisely when pressing the send button...

    You should take a look at GestureRecognizer.ResetMode property, and the corresponding GestureResetMode enum values. This gives you some control over when the GestureRecognizer is going to reset after the required conditions for the gesture are no longer met. Most of the default GestureRecognizers are setup to reset when all the fingers of the last touch sequence have been lifted off the screen. You might want to try the NextFrame reset mode instead, which will tell the GestureRecognizer to reset as soon as possible (the next frame after it failed/succeeded), allowing it to attempt to detect the gesture again.
     
  26. patch24

    patch24

    Joined:
    Mar 29, 2009
    Posts:
    120
    I think it must have been network latency where I was at. At home I don't get that warning as much.
    I'm now focusing in on touch filter stuff

    public FingerGestures.ITouchFilter TouchFilter

    I was just wondering if I could get a quick code snip on how to actually use this in a script? I'm just not sure how to get or set a finger index through this interface. In my code I'm trying to have a pinch zoom ignore a separate screen touch on a virtual joystick. It keeps thinking the pinch should be starting from that point. I can test for screen position of fingers in my OnPinchBegin method....I just can't tell the pinch gesture to ignore that particular out-of-bounds finger since there's no fingerIndex being passed.
     
  27. patch24

    patch24

    Joined:
    Mar 29, 2009
    Posts:
    120
    So, I've been able to get touch id's, touch positions, deltas etc. from many different sources. I can use the OnFingerDown, OnFingerDragMove, OnFingerUp...wihtout any problems. I've written code that tells if the touch should be considered illegal and not used. I just can't tell the Touch Filter to throw out the specific finger.

    I tried setting it up with:

    Code (csharp):
    1. FingerGestures.SingleFingerFilter fingerFilter = new FingerGestures.SingleFilter(finger)
    I think that line is just adding the specific finger to the filter. I'm not sure how to take it away.

    The interface uses Apply() so I was thinking that to make it work I'd need to send a "null" to that specific fingerIndex. Is that correct?

    Has anyone else dealt with this? Thanks for any help.
    -p
     
  28. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    Here's a snippet of the code used by the SingleFingerTouchFilter used by the default GestureRecognizers that trigger the per-finger events. What this filter does is to remove all the fingers from the input list that do not match the finger index assigned to the filter:

    The constructor takes a Finger object as parameter. This is the finger that this filter should keep, and leave the rest out. If you only have a fingerIndex, it's easy to get the corresponding Finger object via FingerGestures.GetFinger(fingerIndex);

    The Apply() method of the TouchFilter takes the unaltered list of touches for this frame, and lets you return another IFingerList as output. You'll want to make this as efficient as possible and avoid dynamic allocations, as this method is going to be called on every frame.

    You can then assign your TouchFilter to your gesture recognizer via the GestureRecognizer.TouchFilter property.

    Did that help, or do you need more details on this?
     
  29. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    271
    Hi there,

    Great package, made things fantastically easy! I've gone through the User Guide and this thread and am having a couple of issues though. (I'm using Javascript)

    The first is that single finger swipe events can be triggered by two fingers. For example: I want to have single finger swipe left do something and double finger swipe left do something else. While the double finger event works, it triggers the single finger simultaneously. (Though not visa versa, obviously) Have I missed something in restricting the double finger condition?

    I have added the 'Finger Gestures Initialiser' to the scene, then in my script added:

    Code (csharp):
    1. function OnEnable()
    2. {
    3.     FingerGestures.OnFingerTap += FingerGestures_OnFingerTap;
    4.     FingerGestures.OnFingerSwipe += FingerGestures_OnFingerSwipe;
    5.     FingerGestures.OnTwoFingerSwipe += FingerGestures_OnTwoFingerSwipe;
    6. }
    7.  
    8. function OnDisable()
    9. {
    10.     FingerGestures.OnFingerTap -= FingerGestures_OnFingerTap;
    11.     FingerGestures.OnFingerSwipe -= FingerGestures_OnFingerSwipe;
    12.     FingerGestures.OnTwoFingerSwipe -= FingerGestures_OnTwoFingerSwipe;
    13. }
    14.  
    15. //And have the correlating functions:
    16.  
    17. function FingerGestures_OnTwoFingerSwipe( startPos : Vector2, direction : FingerGestures.SwipeDirection, velocity : float )
    18. {
    19.  
    20. }
    21.  
    Additionally, I can't seem to work out how the toolbox works. I've tried dragging the script in to an object in my scene, for example TBDrag, but can't seem to get it to actually drag it? I can't seem to find an explanation of the process, though I am likely missing how easy it actually is!

    Thanks in advance for any help.
     
  30. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    This is working as intended. The OnFingerSwipe event is meant to be triggered for each finger independently of the other ones. What you are after is the OnSwipe event instead. The OnSwipe event will trigger if and only if exactly one finger is down. Its "2 fingers" equivalent is the OnTwoFingerSwipe event.

    You need to make sure that you have a TBInputManager manager object present and setup in the scene. It's responsible for shooting object-picking raycasts and forward event messages to the various TBComponent scripts (e.g TBDrag). Take a closer look at the toolbox sample scenes, that should give you a good idea of how to set it up.

    Let me know if you have more questions!
     
    Last edited: Dec 24, 2011
  31. imkira

    imkira

    Joined:
    Dec 26, 2011
    Posts:
    39
    Hello Spk, thank you very much for this amazing plugin. It's really well designed and saved me a lot of work.
    Anyway, I am facing a strange issue using FingerGestures v2.2 and I am unsure whether it is a bug in the plugin or in my code.
    I am using FingerGesturesInitializer.cs to initialize FingerGestures and doing the typical event handler registration like below:

    What happens is that when I call Application.LoadLevel, OnFingerDown starts being called twice per event. When I call Application.LoadLevel again, it starts being called 3 times per event, and so on. I have debugged to make sure I was not registering events twice or so, during the OnEnable/OnDisable that happens during the switching of events, but I couldn't find a problem.
    Then, I digged through FingerGestures' code and found out that PerFinger_OnDown->RaiseOnFingerDown was being called multiple times when the problem manifests itself. Finally, I noticed that FingerGestures.cs' OnEnable function which calls InitFingers is being called unconditionally during the OnEnable/OnDisable I spoke before. Then I tried protecting the object from self-reinitialization with something like

    and it seems to be working properly now. I suppose this is probably not the appropriate fix nor I am sure whether this is some side effect of me using FingerGestures incorrectly.

    Please let me know of your opinion.
    Regards
     
  32. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    271
    Thanks so much, I fixed the single finger swipe and got it working fine. I also had a look at the example for drag and tried to get it working within my own code but couldn't. However I added the TBInputManager to my scene, then the drag works on whatever its script is on.

    Bad move! Hehe.

    I added a rigidbody to the object (Let's say a long rectangle), constrained the movement and rotation (It's a 2d game) and can drag it around. It bumps in to other objects and spins around, however a quick swipe will drag the object straight through a wall or obstacle. Anything I can do to fix this?

    Additionally I don't want the player to be fighting gravity while dragging, though this may be more related to the rigidbody rather than your plugin. But I've tried turning off gravity while being dragged and the object begins floating up if it hits anything. Any ideas for a solution?

    And FINALLY (haha) would it be hard to make it so I can use the drag to move an object around a pivot point? So if I grabbed a big log on one end I could rotate it around the other end, fixed to the ground? I'm going for a similar telekinesis mode to the game Trine, if you've played it? Lifting objects, placing them on top of each other, bumping objects with other objects and rotating stationary platforms around pivot points. Is this outside of the scope of the plugin out of the box?

    Thanks in advance if you can offer any help.
     
    Last edited: Dec 27, 2011
  33. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    271
    Hi imkira, forgive me if this is a silly suggestion, but have you put a FingerGesturesInitializer in each scene? If it's increasing each LoadLevel perhaps the previous FingerGestures have not been destroyed and as such everything is occurring multiple times. If this is the case simply have a single FingerGesturesInitializer in the first scene and add

    DontDestroyOnLoad (this.gameObject);

    In to one of the scripts on the relevant gesture reading object that FingerGesturesInitializer spawns.

    Apologies if this is way off the mark!
     
    Last edited: Dec 27, 2011
  34. imkira

    imkira

    Joined:
    Dec 26, 2011
    Posts:
    39
    Hi gumboots, thanks!
    Such comments are always welcome!

    Actually I confirmed that FingerGesturesInitializer is only added to the initial scene and that I am using the "persistent" option which, internally, does a DontDestroyOnLoad like you said.
    I was wondering if I made some mistake elsewhere on my real project, so I tried to create a minimal project that reproduces this problem like below:

    • Create an empty project and import FingerGestures plugin only (you should have a unsaved scene with the default camera on the hierarchy)
    • Drag and drop a FingerGesturesInitializer prefab to the hierarchy
    • Create an empty GameObject and attach it the script (call it DemoGestures.js) below:


    Code (csharp):
    1.  
    2. #pragma strict
    3.  
    4. function OnEnable()
    5. {
    6.   Debug.Log("OnEnable");
    7.   FingerGestures.OnFingerDown += Demo_OnFingerDown;
    8. }
    9.  
    10. function OnDisable()
    11. {
    12.   Debug.Log("OnDisable");
    13.   FingerGestures.OnFingerDown -= Demo_OnFingerDown;
    14. }
    15.  
    16. function Demo_OnFingerDown(fingerIndex : int, fingerPos : Vector2)
    17. {
    18.   Debug.Log("Finger " + fingerIndex + " down at " + fingerPos);
    19. }
    20.  
    21. function Update()
    22. {
    23.   if (Input.GetButtonDown("Jump"))
    24.   {
    25.     Debug.Log("Loading scene2...");
    26.     Application.LoadLevel("scene2");
    27.   }
    28. }
    29.  

    • Save the scene as "scene1" and add it to the "scenes to build" list in the "Build Settings".
    • Now create another scene
    • Create an empty GameObject and attach it the script DemoGestures.js exactly like scene1
    • Save the scene as "scene2" and add it to the "scenes to build" list in the "Build Settings".
    • Finally switch to scene1 and play the game like explained below:

    1. Click somewhere on the game window only once only and you should get 1 log line like "Finger N down at (X, Y)".
    2. Press "space" to load scene2 and you should get a "Loading scene2...".
    3. Again, click somewhere on the game window only once and you should (I think) keep getting only 1 log like "Finger N down at (X, Y)" but you will actually get 2 duplicate lines. This is the "problem" I am speaking about.

    Below is the log I got on my environment:

    Code (csharp):
    1.  
    2. OnEnable
    3. Creating FingerGestures using Mouse Gestures
    4. Finger 0 down at (159.0, 1082.0)
    5. Loading scene2...
    6. OnDisable
    7. OnEnable
    8. Finger 0 down at (159.0, 1082.0)
    9. Finger 0 down at (159.0, 1082.0)
    10.  
    Best regards.
     
  35. Dejaret

    Dejaret

    Joined:
    Dec 27, 2011
    Posts:
    1
    I really appreciate your work, you have been a great contributor and always share news that I can’t find on other resources.
     
  36. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    Hey guys, sorry for the lack of replies - Im currently away from home with limited net access, so I wont be able to provide much support until i come back on the 4th of January.

    @imkira: thanks for the detailed investigation. It does indeed seem that something is off. I will take a look at this when im back
     
  37. Chetwynde

    Chetwynde

    Joined:
    Dec 29, 2011
    Posts:
    2
    Hi William,

    First thanks SO much for putting out FingerGestures -- they rock!

    However since I updated to your latest version (2.2) I can't get my scripts to access your FingerGestures scripts:

    After learning about Unity's folder-based compilation sequence I've shuffled everything around in every combination that makes sense to me: I used the default placement of your package, put them all (including my own) in Standard Assets/Scripts, put them all in their own folder, put some in plugins, others in Standard Assets, etc. etc. I got it to compile in Unity, but when building to an external project (iOS in this case) the assembly throws an exception when it runs.

    Hopefully I'm missing something HORRIBLY obvious (c# isn't my strongest language)...perhaps there's some equivalent to importing a script reference as in C?

    Have you had trouble with getting c# scripts to reference other scripts in Unity?

    Thanks in advance,

    Miles
     
  38. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    @Chetwynde: it looks like the missing methods are your own event callbacks. Are you sure these methods are available in the Controls.cs source file? If you send me your controls.cs sources I can help you pinpoint the issue. You shouldnt have to shuffle around the FingerGestures files, as they are already located in special folders that can be accessed by both C# and JS.
     
  39. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,621
    Spk your tool is awesome, I used it to create an app which I finally was able to test on an android device and it works perfectly (was doing dev with webplayer). cheers

    Also featured on indienexus.com.
     
  40. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    431
    @Spk : great tool, indeed ! I have two suggestions concerning the TBDragOrbit script :

    - Mouse panning right out-of-the-box (with a right click, or a left click + modifier key, etc.)

    - An option to use some other finger combinations for each kind of camera movement (examples : one finger drag does nothing, two fingers do the panning and three do the rotation ; or one finger drags, two fingers zoom, three fingers rotate, etc.)

    This could make this script very universal, I think.
     
  41. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    Thank you for the nice words Koyima, very much appreciated :)
     
  42. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    Funny you mention this, ive been thinking about adding a separate controller script for the orbit cam so that kind of thing will be easier to pull off. Ill bump this up in the todo list, thanks for the feedbacks.
     
  43. manticor

    manticor

    Joined:
    Oct 29, 2011
    Posts:
    26
    Hi Spk

    Just bought your finger gestures pack yesterday and it works a treat .Nice work

    Im just going through the ready made stuff at the moment ,just dragging on scripts trying stuff out.
    Im a 3D Artist by trade but I have learned Java past the basics so please bear with me with my next question.
    I cannot get a tap or drag event on objects to fire while using the orbit/pan script on the main camera.
    Sorry if this sounds a bit noobish but could you tell me how to overcome this in Javascript please.

    Thanks in advance

    M
     
  44. voncarp

    voncarp

    Joined:
    Jan 3, 2012
    Posts:
    173
    hi

    so far fingergestures work great, except that it is very difficult to grab tiny objects. its easy to grab objects with the mouse pointer in the editor, but near impossible to grab small objects on the touch screen.

    how would you increase the surface area of the object you wanted to grab?

    thanks
     
  45. okimoki

    okimoki

    Joined:
    May 13, 2010
    Posts:
    114
    Hi, im VERY satisfied user of finger gestures!!! Im not a programmer and your skeleton code helped me a lot..
    Now..
    What would be really great and useful.. would be a Penelope's Joystick.js rewritten to use your finger gestures so that those Joystick would work with mouse of on iPhone by default!! I would do it myself.. but.. im dont know how :)))

    But maybe something like that is allready done??
    Thanks
     
  46. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    You could increase the size of their collider. If this is problematic for gameplay reasons, you could increase the thickness of the raycast. Im still away from home at the moment so I dont have my source code with me, but I think I have exposed a property for the thickness of the racyast on the TBInputManager. If not, you should update the TBInputManager raycast method and use a Physics.SphereCast instead, providing a big enough radius.
     
  47. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    Hm I will have to get back to you on this when I come home later this week. This might have something to do with using the OnTap and OnDrag events instead of the per-finger OnFingerTap and OnFingerDrag events. The former will only fire if and only if a single finger is pressed on the screen (which is obviously not the case if the user is already orbiting/panning the camera).
     
  48. spk

    spk

    Joined:
    Jan 9, 2009
    Posts:
    532
    No promises, but if it's quick and easy ill see what I can do :)
     
  49. okimoki

    okimoki

    Joined:
    May 13, 2010
    Posts:
    114
    I think it shouldnt be to hard :) plus, i think it would be a real good selling point! now you HAVE to test it trough Remote, but with your implementationit would work with mouse, iphone or android with no change! No multitouch with mouse of course but for testing without Remote it would be awesome!

    Thanks for even considering it :)
     
  50. manticor

    manticor

    Joined:
    Oct 29, 2011
    Posts:
    26
    No worries dude,I think I'm Crossing over to c# for coding so will take a little time to get my head around it before I'll be needing finger gestures properly So take your time.the prime 31 delegates vid you posted has convinced me to switch .
     
unityunity