Tried enabling any/all gestures with Controller.EnableGesture, tried getting from current frame > gesture(0) or from new CircleGesture (or any other type). Always getting invalid gestures... Here's the code, I'm using LeapInput static class from their Unity example (all it does is saves controller and updates the current frame).
void Update()
{
LeapInput.Update();
Frame thisFrame = LeapInput.Frame;
for (int i = 0; i < thisFrame.Gestures().Count; i++)
{
Gesture gesture = thisFrame.Gesture(i);
}
}
P.s. yes, I'm enabling gestures in the same controller instance.
Do you have the most up to date drivers? (1.0.7+7648 as of this post) Here is your code in my handler class, it returns the circle gesture just fine:
Updated Code (Working).
I wasn't paying attention to the OP's original code. .gestures(0)
won't work, just change to .gestures[0]
, see example below.
using UnityEngine;
using System.Collections;
using Leap;
public class LeapTest : Leap.Listener {
public Leap.Controller Controller;
// Use this for initialization
public void Start () {
Controller = new Leap.Controller(this);
Debug.Log("Leap start");
}
public override void OnConnect(Controller controller){
Debug.Log("Leap Connected");
controller.EnableGesture(Gesture.GestureType.TYPECIRCLE,true);
}
public override void OnFrame(Controller controller)
{
Frame frame = controller.Frame();
GestureList gestures = frame.Gestures();
for (int i = 0; i < gestures.Count; i++)
{
Gesture gesture = gestures[0];
switch(gesture.Type){
case Gesture.GestureType.TYPECIRCLE:
Debug.Log("Circle");
break;
default:
Debug.Log("Bad gesture type");
break;
}
}
}
}