user733
user733

Reputation: 21

Leap Motion circle and swipe gestures are not being Recognised in Unity3D

I have been trying to implement the standard gestures leap motion provides such as the circle gesture and swipe gesture but none of them seems to work. I'm having a hard time understanding why most method that exists in the API are not being recognised in Unity.

Below is code I have used to get a circle gesture.

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;
            }
        }

However, when I put this code into unity3D it doesn't recognise the following lines of code from the code above:

Leap.Controller 
.EnableGesture(Gesture.GestureType.TYPECIRCLE, true);
GestureList gestures = frame.Gestures();

I don't understand what I am missing out here, or is it depreciated? Please, can someone explain? Thankyou

Upvotes: 1

Views: 837

Answers (1)

Adam H
Adam H

Reputation: 1573

Gestures were deprecated in Orion (v3 and above), so if you're using one of the Orion versions of Leap Core Assets then you'll get this error. You can still use the v2 assets if you want to use these Gestures, otherwise you'll need to implement them yourself.

Upvotes: 2

Related Questions