Search code examples
gestureleap-motionkeytab

fingers for KeyTapGesture in leap motion


I want to make an application for typing character which corresponding with specific finger. I have tried with finger.isExtended to sense which finger is "stroke" or bend, but the movement of the fingers should be maximum to be detected using this function.

I would try another function using KeyTapGesture, but I do not know whether this function can be differentiate the finger or known which finger do the tap.

does anyone know how to determine the particular fingers do the tap?

I have add the pointable() and here is my C# code:

case Gesture.GestureType.TYPE_KEY_TAP:
        KeyTapGesture keytap = new KeyTapGesture (gesture);
        controller.Config.SetFloat("Gesture.KeyTap.MinDownVelocity", 40.0f);
        controller.Config.SetFloat("Gesture.KeyTap.HistorySeconds", .2f);
        controller.Config.SetFloat("Gesture.KeyTap.MinDistance", 1.0f);
        controller.Config.Save();
        HandList handsForGesture = gesture.Hands;
        Hand rightHand = handsForGesture[0];
        Pointable tappingPointable = keytap.Pointable;
        PointableList pointablesForGesture = rightHand.Pointables;

        int exFingers = 0;
        for (int f = 0; f < rightHand.Pointables.Count; f++)
            {
              Pointable digit = rightHand.Pointables[f];
              if (digit.IsValid)
                {
                    exFingers++;
                    SafeWriteLine("Finger: " + f);
                  }
              }
    break;

And the result is all the fingers do the tap even though I did only with one finger.


Solution

  • The KeyTap gesture object has a pointable() attribute for this purpose. (Use pointableIds in JavaScript.)