Search Unity

Error CS 0136 while writing Leap Motion Gesture control

Discussion in 'Scripting' started by mayank_chaurasia, Jun 11, 2018.

  1. mayank_chaurasia

    mayank_chaurasia

    Joined:
    Nov 10, 2016
    Posts:
    4
    Hi I m new to Unity coding and had seen a tutorial for the swipe gesture recognition using Leap motion and had written the code also but it is giving me a error on line
    controller.EnableGesture(Gesture.GestureType.TYPESWIPE);
    which i m not able to understand

    I have been using Leap_Motion_Orion_Setup_win_3.2.1

    A local variable named gesture cannot be declered in this scope because it would give a different meaning to 'gesture', which is already used in a parent or current scope to denote something else

    the code which i had used is as follows

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using Leap;
    using Leap.Unity;

    public class GestureHand : MonoBehaviour {
    Controller controller;

    void Start () {
    Controller = new Controller ();
    controller.EnableGesture(Gesture.GestureType.TYPESWIPE);
    controller.Config.SetFloat ("Gesture.Swipe.MinLength", 200.0f);
    controller.Config.SetFloat ("Gesture.Swipe.MinVelocity", 750f);
    controller.Config.Save ();
    }


    void Update () {
    Frame frame = controller.Frame ();
    GestureList gesture = frame.Gesture ();
    for (int i = 0; i < gesture.Count; i++)
    {
    Gesture gesture = gesture;
    if(gesture.Type == gesture.GestureType.TYPESWIPE)
    {
    SwipeGesture = new SwipeGesture(gesture);
    Vector swipeDirection = Swipe.Direction;
    if(swipeDirection.x < 0){
    Debug.Log("Left");
    }else if (swipeDirection.x > 0){
    Debug.Log("Right");
    }
    }
    }
    }
    }