如何使用leap motion controller获取做出手势的特定手指

How to get the specific finger that made gesture with leap motion controller

我正在尝试从 Leap Motion 控制器找出哪个手指执行了 KEY_TAP 手势。

我有这个代码:

谁能在 JAVA 中举例说明如何获得做出手势的 finger/fingers(如果不止一个)?

点击手势有一个 pointables() method that gives you the tapping pointable -- there will be only one per tap, though you can have multiple fingers tapping at the same time. To identify the finger, you can use the Finger.type() 方法(在检查点击指针是手指后——它也可能是工具)。获得手势列表后,您可以按如下方式识别轻敲手指:

for(Gesture gesture : gestures){
  if(gesture.type() == KeyTapGesture.classType()){
    KeyTapGesture keytap = new KeyTapGesture(gesture);
    Pointable tappingPointable = keytap.pointable();
    if(tappingPointable.isFinger()){
      Finger tappingFinger = new Finger(tappingPointable);
      println("Tapper: " + tappingFinger.type());
    }
  }
}