Search Unity

[NEW UPDATE!] Fingers - Touch Gestures - #1 in Quality, Support and Features : Dozens of Gestures✓

Discussion in 'Assets and Asset Store' started by jjxtra, Apr 25, 2016.

  1. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    That’s the right function. I think you want to add executing stage as well.
     
  2. Alf-Dee

    Alf-Dee

    Joined:
    May 12, 2016
    Posts:
    6
    Hi, I'm using fingers to detect both pan (virtual joystick) and swipe (up and down) to jump and crouch, but while it works in the editor, the swipe does not work at all when building on Android
    Code (CSharp):
    1.        
    2. private void OnEnable()
    3.         {
    4.             panGesture = new PanGestureRecognizer
    5.             {
    6.                 PlatformSpecificView = PanPlatformSpecificView,
    7.                 ThresholdUnits = PanGestureThresholdUnits
    8.             };
    9.             panGesture.StateUpdated += Panned;
    10.  
    11.             swipeGesture = new SwipeGestureRecognizer ();
    12.             swipeGesture.PlatformSpecificView = SwipeImage;
    13.             swipeGesture.ThresholdSeconds = SwipeThresholdSeconds;
    14.             swipeGesture.DirectionThreshold = 0;
    15.             swipeGesture.MinimumNumberOfTouchesToTrack = swipeGesture.MaximumNumberOfTouchesToTrack = SwipeTouchCount;
    16.             swipeGesture.EndMode = SwipeMode;
    17.             swipeGesture.StateUpdated += Swipe_Updated;
    18.  
    19.  
    20.             if (!string.IsNullOrEmpty(CrossPlatformInputHorizontalAxisName) && !string.IsNullOrEmpty(CrossPlatformInputVerticalAxisName))
    21.             {
    22.                 crossPlatformInputHorizontalAxisObject = FingersCrossPlatformInputReflectionScript.RegisterVirtualAxis(CrossPlatformInputHorizontalAxisName, out crossPlatformInputAxisMoveNewlyRegistered);
    23.                 crossPlatformInputVerticalAxisObject = FingersCrossPlatformInputReflectionScript.RegisterVirtualAxis(CrossPlatformInputVerticalAxisName, out crossPlatformInputAxisMoveNewlyRegistered);
    24.             }
    25.             if (!string.IsNullOrEmpty(CrossPlatformInputJumpAxisName))
    26.             {
    27.                 crossPlatformInputJumpAxisObject = FingersCrossPlatformInputReflectionScript.RegisterVirtualAxis(CrossPlatformInputJumpAxisName, out crossPlatformInputAxisJumpNewlyRegistered);
    28.             }
    29.             clearJumpAction = ClearJump;
    30.  
    31.  
    32.             FingersScript.Instance.AddGesture(panGesture);
    33.             FingersScript.Instance.AddGesture(swipeGesture);
    34.         }
    If I comment the "FingersScript.Instance.AddGesture(panGesture);" line, the swipe start working also on Android builds.

    My swipe method looks like that:
    Code (CSharp):
    1.         private void Swipe_Updated(DigitalRubyShared.GestureRecognizer gesture)
    2.         {
    3.  
    4.  
    5.             SwipeGestureRecognizer swipe = gesture as SwipeGestureRecognizer;
    6.             Debug.LogFormat("Swipe state: {0}", swipe.State);
    7.             if (swipe.State == GestureRecognizerState.Ended)
    8.             {
    9.                 float angle = Mathf.Atan2(-swipe.DistanceY, swipe.DistanceX) * Mathf.Rad2Deg;
    10.  
    11.                 Debug.LogFormat("Swipe dir: =====> {0}", swipe.EndDirection);
    12.  
    13.                 if (swipe.EndDirection == SwipeGestureRecognizerDirection.Up)
    14.                 {
    15.                     SwipeUpCallback.Invoke();
    16.                 }
    17.                 else if (swipe.EndDirection == SwipeGestureRecognizerDirection.Down)
    18.                 {
    19.                     SwipeDownCallback.Invoke();
    20.                 }
    21.             }
    22.         }
    What I notice from logcat is that "swipe.State" is never equal to GestureRecognizerState.Ended
    If I read the logs in the Unity console, the Ended states appears correctly.

    Can you help me please?
    Thanks in advance!
     
  3. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Pan needs to be set to execute simultaneously with swipe.
     
  4. VolodymyrDrach

    VolodymyrDrach

    Joined:
    Dec 28, 2015
    Posts:
    7
    Hello! I am wondering if multi-finger touch can be implemented using this plugin? I'm interested in simultaneous touch. I want to make some unique beautiful swipe using multiple fingers.
     
  5. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Of course. This is set up by default.
     
  6. VolodymyrDrach

    VolodymyrDrach

    Joined:
    Dec 28, 2015
    Posts:
    7
    Did you answer this question? "Hello! I am wondering if multi-finger touch can be implemented using this plugin? I'm interested in simultaneous touch. I want to make some unique beautiful swipe using multiple fingers." Show the diagram a picture of how to make a swipe with several fingers
     
  7. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Yes, this is on by default. You can specify the max number and min number required fingers per gesture.
     
  8. anguyen2023

    anguyen2023

    Joined:
    Aug 21, 2021
    Posts:
    1
    Hi Jeff, I have this code right now for my AR application. How should I modify the Finger Rotate Scale for this object?
    Thank you!

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.XR.ARFoundation;
    5. using UnityEngine.EventSystems;
    6.  
    7. public class SpawnableManager : MonoBehaviour
    8. {
    9.     [SerializeField]
    10.     ARRaycastManager m_RaycastManager;
    11.     List<ARRaycastHit> m_Hits = new List<ARRaycastHit>();
    12.     [SerializeField]
    13.     public GameObject[] spawnable;
    14.  
    15.     Camera arCam;
    16.     GameObject spawnedObject;
    17.  
    18.     // Start is called before the first frame update
    19.     void Start()
    20.     {
    21.         spawnedObject = null;
    22.         // find by name, and the component of that GameObject
    23.         arCam = GameObject.Find("AR Camera").GetComponent<Camera>();
    24.     }
    25.  
    26.     // Update is called once per frame
    27.     private void SpawnPrefab(Vector3 spawnPosition)
    28.     {
    29.         if (ChangeToSphere.change)
    30.         {
    31.             spawnedObject = Instantiate(spawnable[1], spawnPosition, Quaternion.identity);
    32.         }
    33.         else
    34.         {
    35.             spawnedObject = Instantiate(spawnable[0], spawnPosition, Quaternion.identity);
    36.         }
    37.     }
    38.  
    39.     bool IsPointOverUIObject(Vector2 pos)
    40.     {
    41.         if (EventSystem.current.IsPointerOverGameObject())
    42.             return false;
    43.  
    44.         PointerEventData eventDataCurrentPosition = new PointerEventData(EventSystem.current);
    45.         eventDataCurrentPosition.position = new Vector2(pos.x, pos.y);
    46.         List<RaycastResult> results = new List<RaycastResult>();
    47.         EventSystem.current.RaycastAll(eventDataCurrentPosition, results);
    48.         return results.Count > 0;
    49.  
    50.     }
    51.     void Update()
    52.     {
    53.         if (Input.touchCount == 0)
    54.             return;
    55.  
    56.         RaycastHit hit;
    57.         Ray ray = arCam.ScreenPointToRay(Input.GetTouch(0).position);
    58.         if (!IsPointOverUIObject(Input.GetTouch(0).position) && m_RaycastManager.Raycast(Input.GetTouch(0).position, m_Hits)) // return True if there is at least one hit
    59.         {
    60.             if (Input.GetTouch(0).phase == TouchPhase.Began && spawnedObject == null)
    61.             {
    62.                 if (Physics.Raycast(ray, out hit))
    63.                 {
    64.                     if (hit.collider.gameObject.tag == "Spawnable")
    65.                     {
    66.                         spawnedObject = hit.collider.gameObject;
    67.                     }
    68.                     else
    69.                     {
    70.                         SpawnPrefab(m_Hits[0].pose.position);
    71.                     }
    72.                 }
    73.             }
    74.             else if (Input.GetTouch(0).phase == TouchPhase.Moved && spawnedObject != null)
    75.             {
    76.                 spawnedObject.transform.position = m_Hits[0].pose.position;
    77.             }
    78.             if (Input.GetTouch(0).phase == TouchPhase.Ended)
    79.             {
    80.                 spawnedObject = null;
    81.             }
    82.         }
    83.  
    84.     }
    85. }
    86.  
     
  9. JiachenZeng

    JiachenZeng

    Joined:
    May 18, 2021
    Posts:
    2
    Hi! I'm new to this. I imported the asset into a nearly empty Unity 2D project. And then it showed 2 errors. Could there be any setting wrong? I'm using Unity 2020.3.21f1 on Windows 10.

    Code (CSharp):
    1. Assets\Fingers\Demo\Scripts\DemoScriptPlaceObjects.cs(45,49): error CS0246: The type or namespace name 'GestureRecognizer' could not be found (are you missing a using directive or an assembly reference?)
    2. Assets\Fingers\Demo\Scripts\DemoScriptPlaceObjects.cs(22,16): error CS0246: The type or namespace name 'FingersPanOrbitComponentScript' could not be found (are you missing a using directive or an assembly reference?)
     
  10. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    I'm not seeing this. What fingers version are you running on?
     
  11. JiachenZeng

    JiachenZeng

    Joined:
    May 18, 2021
    Posts:
    2
    I just imported it yesterday and the version seems to be 3.0.3. Currently, I have installed Visual Studio with only Unity target. May this be the cause?

    And if I open and try to import, it doesn't show the proper class to be imported. Which GestureRecognizer it is? Windows.UI.Input.GestureRecognizer seems to be UWP which I didn't install.
    https://imgur.com/a/gr5L58O

    EDIT:
    I deleted the Library folder and reopened the project. Then it works fine. Seems to be a problem after upgrading the project version.
     
    Last edited: Nov 7, 2021
  12. Caffeen

    Caffeen

    Joined:
    Dec 25, 2013
    Posts:
    34
    Hi, apologies if this has been asked before; I didn't find what I was looking for by searching this thread.

    I'm having an issue where in Android builds, the FingerHandlerScript.Touches.Count never resets when my fingers are no longer touching the screen.

    It works fine in the editor; it returns 1 when the mouse button is held down, and returns to 0 when the button is released, but on my phone, touching the screen changes Touches.Count from 0 to 1 as expected, but when I remove my finger it remains at 1.
    Because of this, my 1-finger Pan gesture only works at the beginning. Once I've touched the screen with two fingers to use my 2-finger Pan gesture, the 1-finger Pan no longer works. Everything works as expected in the Editor.

    Strangely enough, switching to another app and back (Without restarting it) resets the Touches.Count back to 0 and I can use my 1-finger Pan again until I touch with two fingers.

    It's possible I've set the gestures up incorrectly? I based it on DemoScript.cs.

    I'm using 2019.4 and the new Input System. (I followed the instructions for it in the readme)

    Thanks in advance!
     
  13. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Probably the first thing to try is does the old input system work?
     
  14. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Are you still dealing with this error?
     
  15. Caffeen

    Caffeen

    Joined:
    Dec 25, 2013
    Posts:
    34
    Yes, I ran out of time and ended up having to change everything back to the old input system to make it work. Changing to the old input system made it work as expected with no additional tweaking of anything related to Fingers.
     
  16. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    I had to click on the event system in the scene and click a button to enable new input system functionality. Once I did that, the new input system started working as expected, I got taps and double taps in the tapdoubletap demo scene. I will add a note for this in the readme.
     
    Last edited: Nov 18, 2021
  17. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Fingers Gestures 3.0.4 is now live on the asset store with fixes for touches when using the new input system.
     
  18. tarasrng

    tarasrng

    Joined:
    May 18, 2017
    Posts:
    11
    Hey guys! I'm having a weird issue with SwipeGestureRecognizer. The level is lazy-loaded from several scenes dynamically. And after the first UnloadSceneAsync of any loaded scene, SwipeGestureRecognizer just stops working. Resetting or creating a new instance of it doesn't help.

    The unloaded scene contains a level itself - just a bunch of line renderers. Everything else is not destroyed.

    The game object with a script that initializes SwipeGestureRecognizer is set to not be destroyed on load.
    EventSystem and FingersScriptPrefab game objects are also set to not be destroyed, so scene unloading doesn't affect them.

    The only workaround to fix the issue I found so far is to destroy and re-instantiate a game object with a script that initializes SwipeGestureRecognizer. Do you guys have any ideas why is that happening?
     
  19. tarasrng

    tarasrng

    Joined:
    May 18, 2017
    Posts:
    11
    Just found a similar issue in a discord - FingersScript.GestureLevelUnloadOption.Nothing; - this is what I needed :)
     
    jjxtra likes this.
  20. gamefirestudio

    gamefirestudio

    Joined:
    Sep 22, 2021
    Posts:
    1
    Hi, I have a question about fingers zoom pan, and tap gesture working with a ui panel.
    I want to create a full screen ui panel, and hope zoom pan and tap gesture will not be triggered when this ui panel shown.
    I enabled and disable zoom pan and tap gesture script when open and close ui panel.
    May I know whether there is a easy to implement the same function?

    Thank you very much
     
  21. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    The CaptureGestureHandler func on the FingersScript.Instance is perfect for this. Set it to your C# function and if the game object parameter of the function is your panel, then return true to eat the gesture.
     
  22. User414322

    User414322

    Joined:
    Jul 9, 2019
    Posts:
    27
    I can't seem to get double taps to work...

    My code is fairly straightforward:
    Code (CSharp):
    1. void Start()
    2.     {
    3.         tapGesture = new TapGestureRecognizer();
    4.         tapGesture.StateUpdated += TapGestureCallback;
    5.         tapGesture.RequireGestureRecognizerToFail = doubleTapGesture;
    6.         FingersScript.Instance.AddGesture(tapGesture);
    7.         doubleTapGesture = new TapGestureRecognizer();
    8.         doubleTapGesture.NumberOfTapsRequired = 2;
    9.         doubleTapGesture.StateUpdated += DoubleTapGestureCallback;
    10.         FingersScript.Instance.AddGesture(doubleTapGesture);
    11.         swipeGesture = new SwipeGestureRecognizer();
    12.         swipeGesture.Direction = SwipeGestureRecognizerDirection.Down;
    13.         swipeGesture.DirectionThreshold = 1.0f;
    14.         swipeGesture.StateUpdated += SwipeGestureCallback;
    15.         FingersScript.Instance.AddGesture(swipeGesture);
    16.     }
    Followed by
    Code (CSharp):
    1. private void TapGestureCallback(DigitalRubyShared.GestureRecognizer gesture)
    2.     {
    3.         if (gesture.State == GestureRecognizerState.Ended)
    4.         {
    5.             Debug.Log("Single tap");
    6.         }
    7.     }
    8.  
    9.     private void DoubleTapGestureCallback(DigitalRubyShared.GestureRecognizer gesture)
    10.     {
    11.         if (gesture.State == GestureRecognizerState.Ended)
    12.         {
    13.             Debug.Log("DOUBLE tap");
    14.         }
    15.     }
    16.  
    17.     private void SwipeGestureCallback(DigitalRubyShared.GestureRecognizer gesture)
    18.     {
    19.         if (gesture.State == GestureRecognizerState.Ended)
    20.         {
    21.             Debug.Log("Swipe");
    22.         }
    23.     }
    It is able to detect single taps and swipes according to the console (and the fact that I can click on UI buttons). But double taps don't seem to be giving me any logs...
     
  23. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Does demo scene tap and double tap work? If so you may just need to set your gestures to execute simultaneously.
     
    Last edited: Feb 11, 2022
  24. User414322

    User414322

    Joined:
    Jul 9, 2019
    Posts:
    27
    The demo does work. Sorry for the obvious question but... how do I set gestures to execute simultaneously?
     
  25. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Call
    gesture.AllowSimultaneousExecution(otherGesture)
     
  26. User414322

    User414322

    Joined:
    Jul 9, 2019
    Posts:
    27
    Yes

    doubleTapGesture.AllowSimultaneousExecution(tapGesture);
    does make it work, but comes with the issue that now whenever I double tap it also registers two regular taps on top.
     
  27. User414322

    User414322

    Joined:
    Jul 9, 2019
    Posts:
    27
    I found the issue, a rather foolish one on my side too. The

    RequireGestureRecognizerToFail
    is unable to do anything because

    doubleTapGesture
    does not yet exist. In my original script the single tap is created before the double-tap.

    Though I am surprised that this did not return an error on the console. Nevertheless, thank you for the speedy replies!
     
    jjxtra likes this.
  28. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Set the double tap gesture to require the tap gesture to fail.
     
  29. tarasrng

    tarasrng

    Joined:
    May 18, 2017
    Posts:
    11
    Hey guys. I faced a lot of memory allocations using Fingers scripts due to excessive foreach usage on IEnumerable/ICollection variables.

    I'm using the latest unity, latest Fingers asset (3.0.4) and IL2CPP build.

    upload_2022-2-20_0-44-55.png

    upload_2022-2-20_0-41-27.png

    Profiling on device shows a lot of allocation in foreach methods due to Enumerator retrieval:
    upload_2022-2-20_0-47-10.png

    There are a lot of usages of foreach in the code, so it makes such allocations basically in every frame!
    As far as I know, Unity fixed this issue, so foreach shouldn't allocate, but my testing shows that it's not true.

    Am I missing something, or that's the real problem, and every foreach loop just must be replaced with the for loop?
     
  30. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Sounds like a regression for unity. I’d file a bug…
     
  31. Masashi-Wada

    Masashi-Wada

    Joined:
    Jul 6, 2010
    Posts:
    89
    Hi jjxtra.
    Fingers are a great product. It is an essential part of my product.

    Me too, FingersScript keeps generating some GC Alloc every frame.
    It always happens even if the user does not touch the screen, so the accumulation reaches 100KB/sec. I'm requesting that this be removed. It is acceptable because it is necessary to be Alloc to notify the touch information. However, it is a pity that it kept leaking when I was not touching it.

    Unity handles foerach properly for List<T> and Dictionary<T>, but not for other collections. (It hasn't changed since a few years ago)
    See that the profiler is only happening to the ReadOnlyCollection.
    Also, Sort () causes a slight GC Alloc. I think Fingers should handle this.

    Fingers ver 3.0.4
    Unity 2020.3.28 (windows10)
    new input system package 1.30
    run profile on android 11.

    profiler screenshot
    https://1drv.ms/u/s!AvcuZoh1w1iziu5_VuZNdX8oe7_37Q?e=WFpeTx
     
  32. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    I can look into this. If it is not impacting your frame rates or causing app crash then I would consider it non-critical.
     
  33. FeatherGameStudio

    FeatherGameStudio

    Joined:
    Jan 9, 2018
    Posts:
    1
    Hi.My UI camera's render mode is ScreenSpaceCamera.How do I use FingersJoystickScript?
     
  34. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    I’d have to make some adjustment to that script as it assumes screen space overlay.
     
  35. nanditho

    nanditho

    Joined:
    Jan 10, 2018
    Posts:
    27
    I would like to do camera pan (my camera always see on one target / the gameobject) then I want to be able to rotate the gameobject based on the camera pan (on gameobject axis: X, Y, and Z), how is it possible?

    Thanks
     
  36. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    A pan gesture will make it easy to pan the camera. For rotating the game object, simply read the deltax/deltay properties of the pan gesture and apply some rotation to the game object on your desired axis.
     
  37. nanditho

    nanditho

    Joined:
    Jan 10, 2018
    Posts:
    27

    Thank for response.

    This is the detail I would like to achieve

    What I want to achieve is ability to rotate a game object in all axis (x, y, z) regarding the camera position / rotation.

    The camera will always focus on the game object and rotate around the game object.

    So whenever the camera rotate on specific angle I would like to detect that any drag / swipe gesture (x swipe, or y swipe) on screen will rotate the game object on the specific axis (x, y, z) that Perpendicular to the swipe / drag gesture.

    Please advice Thanks
     
  38. unwshd_elend

    unwshd_elend

    Joined:
    Mar 21, 2019
    Posts:
    23
    Hello I had a question about ImageRecognition and its accuracy
    I've set the
    ImageGestureImage - imageRows field value to 40 (I think it effects the accuracy right?)
    and score padding = 0.01 and similarity minimum to 1
    still my shape doesnt get recognized correctly
    im trying on "infinity" shape
    the shape below is still considered infinity
    same thing sometimes happen between a circle and a rectangle
    how can I improve this?
     
  39. shubham144477

    shubham144477

    Joined:
    Sep 23, 2021
    Posts:
    1
    Hey guys, I have a scene where I want the Image object to Zoom out, as the touch event ends (Pinch to zoom). I am referring to ZoomableScrollView Demo scene here, but cant exactly figure out how to make it so that when the touch event ends, the image should zoomout to its original size and anchor. Can Anyone help with with this? Thanks :)
     
  40. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,115
    can i integrate this asset with Visual Scripting (the old Bolt) ? And if yes how? Please explain like I'm 5 years old if you have time.

    Thanks :)
     
  41. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    You can try using the component gesture objects, I think Bolt should be able to reference these...
     
  42. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Apologies for not responding the last few months on this forum. Several things have made life very difficult:
    - Nasty cold in March
    - Influenza in April
    - Covid in May
    - Unity bug that has existed for years stops emailing forums post notifications

    I am trying to get my health back and it's slow going, I will try to remember to re-enable the email notifications for the forum more often...
     
  43. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,115
    try a mix of getting sun every day with a normal walk to move the muscle at least one hour. then buy from your pharmacy one of those mix of vitamins. more there are inside better it is. then buy the one that have D3 vitamin. Not all of them have it. you need that to not be a small dose.

    this should help you up.

    if you are not ok at the moment, get an antibiotic.

    consult your doctor first off course :)
     
  44. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Thank you I will try upping the vitamins and get some sun :)
     
  45. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611
    Hi,here
    Great job for mobile input! And I got a question that how to cosume tap event(driven by fingers gestures like tapGesture) when tapping on a existing UI button(Or a Image which got a component that implements “IPointerUpHandler”),In my case screen UI button would be more priority than screen touches(somewhat blank area). So how to implement that?:D
     
  46. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Buttons will block the gesture by default. You can add typeof(Image) to the ComponentTypesToDenyPassThrough property on FingersScript to block images.
     
  47. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611
    In my case, It looks failed to block gestures on a "Button" . The touches show still visible when touching on a Button.. Shoud I config somewhere for blocking?
     
  48. TheSky

    TheSky

    Joined:
    Feb 16, 2015
    Posts:
    46
    I wonder if its possible to change the finger, which is tracked by a pan-gesture, without lifting all fingers.

    What i mean is the following:

    1. You put finger_1 on the screen, an the pan-gesture-callback reacts on it (for example it's moving something).
    2. Now you put another finger, finger_2, on the screen. Now two fingers are on the screen. The pan-gesture-callback should not react anymore. (Instead maybe another gesture, like scale, should react here)
    3. Now you are lifting finger_1. Only finger_2 is now on the screen, and the pan-gesture-callback is reacting again.

    The reason for this whole thing, is just to make a smooth transition between gestures, whithout lifting all the fingers.
    I tried to get it to work, but to no avail. It is possible?
     
  49. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    @jjxtra Do you have any examples for multiple selecting objects like in a word game. e.g. a 5 x 5 matrix and selecting all the boxes you swipe over.
     
  50. kevinetourneau

    kevinetourneau

    Joined:
    Oct 3, 2017
    Posts:
    9
    First of all, great job about Fingers ! It's a fantastic gesture package !

    We try to do a Gizmo rotation with one touch gesture (pan gesture) but we have some trouble.

    This is what we actually try (work in progress) :
    Code (CSharp):
    1. enum RotationMode { X, Y }
    2.  
    3. void PanGestureGestureUpdated (GestureRecognizer panGesture) {
    4.     if (panGesture.State == GestureRecognizerState.Executing) {
    5.         Vector2 screenDirection = new Vector2 (turnSpeed * panGesture.DeltaX, turnSpeed * panGesture.DeltaY);
    6.         Vector2 worldScreenDirection = Camera.main.transform.TransformDirection (screenDirection);
    7.         Vector3 projectedDirection = Vector3.ProjectOnPlane (worldScreenDirection, rotationMode == RotationMode.X ? transform.right : transform.up);
    8.         transform.Rotate (rotationMode == RotationMode.X ? Vector3.right : Vector3.up, rotationMode == RotationMode.X ? -projectedDirection.y : projectedDirection.x, Space.Self);
    9.     }
    10. }
    Can anyone help us to have a working pan gesture to turn an object around self axis ?

    This is what we want to do : https://threejs.org/examples/?q=control#misc_controls_transform
    Toggle rotation mode (press E) and local mode (press Q).