Kinect for Unity V2 代碼示例(三) 手勢控制

using UnityEngine;
using System.Collections;
using System;
using UnityEngine.UI;

public class GestureControlTest : MonoBehaviour,KinectGestures.GestureListenerInterface {

    private Text text;

    // Use this for initialization
    void Start()
    {
        text = GetComponent<Text>();
    }

    // Update is called once per frame
    void Update()
    {

    }
    public bool GestureCancelled(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint)
    {
        return true;
    }

    public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint, Vector3 screenPos)
    {

        if(gesture == KinectGestures.Gestures.SwipeRight)
        {
            text.text = "用戶 SwipeRight 手勢";
            print("用戶 SwipeRight 手勢");
        }

        return true;
    }

    public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectInterop.JointType joint, Vector3 screenPos)
    {
       
    }

    public void UserDetected(long userId, int userIndex)
    {
        text.text = "檢測到手勢";
        print("檢測到手勢");
    }

    public void UserLost(long userId, int userIndex)
    {
        text.text = "手離開了";
        print("手離開了");
    }

   
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章