Пример #1
0
    private void Start()
    {
        whiteTex = new Texture2D(1, 1, TextureFormat.RGB24, false);
        whiteTex.SetPixels(new Color[] { Color.white });
        whiteTex.Apply();

        // Set defaults and fix incorrect scaling issue w/ distributed Unity project (units are in mm, not cm)
        Leap.UnityVectorExtension.InputOffset = Vector3.zero;
        Leap.UnityVectorExtension.InputScale  = Vector3.one * 0.001f;

        LeapInputEx.Controller.EnableGesture(Gesture.GestureType.TYPECIRCLE);
        LeapInputEx.Controller.EnableGesture(Gesture.GestureType.TYPEKEYTAP);
        // Not sure if these are working; Experimenting with these to improve the key tap
//		Debug.Log(LeapInputEx.Controller.Config.SetFloat("Gesture.KeyTap.MinDownVelocity", 0f));
//		Debug.Log(LeapInputEx.Controller.Config.SetFloat("Gesture.KeyTap.MinDistance", 0f));
//		Debug.Log(LeapInputEx.Controller.Config.Save());
        LeapInputEx.Controller.EnableGesture(Gesture.GestureType.TYPESWIPE);
        LeapInputEx.GestureDetected += OnGestureDetected;

        pointables   = new GameObject[10];
        pointableIDs = new int[pointables.Length];
        for (int i = 0; i < pointables.Length; i++)
        {
            pointableIDs[i] = -1;
            pointables[i]   = CreatePointable(transform, i);
        }

        LeapInputEx.PointableFound   += OnPointableFound;
        LeapInputEx.PointableLost    += OnPointableLost;
        LeapInputEx.PointableUpdated += OnPointableUpdated;

        foreach (GameObject pointable in pointables)
        {
            updatePointable(Leap.Pointable.Invalid, pointable);
        }

        webCamPics = GetComponentInChildren <WebCamPictures>();
    }
Пример #2
0
    private void Start()
    {
        whiteTex = new Texture2D(1, 1, TextureFormat.RGB24, false);
        whiteTex.SetPixels(new Color[] { Color.white });
        whiteTex.Apply();

        // Set defaults and fix incorrect scaling issue w/ distributed Unity project (units are in mm, not cm)
        Leap.UnityVectorExtension.InputOffset = Vector3.zero;
        Leap.UnityVectorExtension.InputScale = Vector3.one * 0.001f;

        LeapInputEx.Controller.EnableGesture(Gesture.GestureType.TYPECIRCLE);
        LeapInputEx.Controller.EnableGesture(Gesture.GestureType.TYPEKEYTAP);
        // Not sure if these are working; Experimenting with these to improve the key tap
        //		Debug.Log(LeapInputEx.Controller.Config.SetFloat("Gesture.KeyTap.MinDownVelocity", 0f));
        //		Debug.Log(LeapInputEx.Controller.Config.SetFloat("Gesture.KeyTap.MinDistance", 0f));
        //		Debug.Log(LeapInputEx.Controller.Config.Save());
        LeapInputEx.Controller.EnableGesture(Gesture.GestureType.TYPESWIPE);
        LeapInputEx.GestureDetected += OnGestureDetected;

        pointables = new GameObject[10];
        pointableIDs = new int[pointables.Length];
        for( int i = 0; i < pointables.Length; i++ )
        {
            pointableIDs[i] = -1;
            pointables[i] = CreatePointable(transform, i);
        }

        LeapInputEx.PointableFound += OnPointableFound;
        LeapInputEx.PointableLost += OnPointableLost;
        LeapInputEx.PointableUpdated += OnPointableUpdated;

        foreach (GameObject pointable in pointables)
        {
            updatePointable(Leap.Pointable.Invalid, pointable);
        }

        webCamPics = GetComponentInChildren<WebCamPictures>();
    }