void Start() { KinectManager manager = KinectManager.Instance; if(validateKinectManager && debugText != null) { if(manager == null || !manager.IsInitialized()) { debugText.GetComponent<GUIText>().text = "KinectManager is not initialized!"; levelLoaded = true; } } if(manager != null && manager.IsInitialized()) { savedCalibrationPose = manager.playerCalibrationPose; manager.playerCalibrationPose = expectedUserPose; } }
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos) { return(true); }
public bool GestureCancelled(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint) { return(true); }
public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectInterop.JointType joint, Vector3 screenPos) { //... }
public bool GestureCancelled(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint) { // don't do anything here, just reset the gesture state return(true); }
public void GestureInProgress(uint userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectWrapper.SkeletonJoint joint, Vector3 screenPos) { // don't do anything here }
/// <summary> /// Invoked when a gesture is in progress. /// </summary> /// <param name="userId">User ID</param> /// <param name="userIndex">User index</param> /// <param name="gesture">Gesture type</param> /// <param name="progress">Gesture progress [0..1]</param> /// <param name="joint">Joint type</param> /// <param name="screenPos">Normalized viewport position</param> public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectInterop.JointType joint, Vector3 screenPos) { // the gestures are allowed for the primary user only if (userIndex != playerIndex) { return; } //if(gesture == KinectGestures.Gestures.ZoomOut) //{ // if(progress > 0.5f) // { // zoomOut = true; // zoomFactor = screenPos.z; // if(gestureInfo != null) // { // string sGestureText = string.Format ("{0} factor: {1:F0}%", gesture, screenPos.z * 100f); // gestureInfo.text = sGestureText; // progressDisplayed = true; // progressGestureTime = Time.realtimeSinceStartup; // } // } // else // { // zoomOut = false; // } //} //else if(gesture == KinectGestures.Gestures.ZoomIn) //{ // if(progress > 0.5f) // { // zoomIn = true; // zoomFactor = screenPos.z; // if(gestureInfo != null) // { // string sGestureText = string.Format ("{0} factor: {1:F0}%", gesture, screenPos.z * 100f); // gestureInfo.text = sGestureText; // progressDisplayed = true; // progressGestureTime = Time.realtimeSinceStartup; // } // } // else // { // zoomIn = false; // } //} //else if(gesture == KinectGestures.Gestures.Wheel) //{ // if(progress > 0.5f) // { // wheel = true; // wheelAngle = screenPos.z; // if(gestureInfo != null) // { // string sGestureText = string.Format ("Wheel angle: {0:F0} deg.", screenPos.z); // gestureInfo.text = sGestureText; // progressDisplayed = true; // progressGestureTime = Time.realtimeSinceStartup; // } // } // else // { // wheel = false; // } //} //if (gesture == KinectGestures.Gestures.Run) //{ // if (progress > 0.5f) // { // run = true; // if (gestureInfo != null) // { // string sGestureText = string.Format("Estas corriendo!!!"); // gestureInfo.text = sGestureText; // progressDisplayed = true; // progressGestureTime = Time.realtimeSinceStartup; // } // } // else // { // run = false; // } //} if (gesture == KinectGestures.Gestures.Move) { if (progress > 0.5f) { move = true; if (gestureInfo != null) { string sGestureText = string.Format("Estas moviendote!!!"); gestureInfo.text = sGestureText; progressDisplayed = true; progressGestureTime = Time.realtimeSinceStartup; } } else { run = false; } } }
public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, Windows.Kinect.JointType joint, Vector3 screenPos) { }
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.SkeletonJoint joint, Vector3 screenPos) { string sGestureText = gesture + ""; if (GestureInfo != null) { GestureInfo.GetComponent <GUIText>().text = sGestureText + " detected"; } if (GestureInfo2 != null) { if (sGestureText.Equals("SwipeLeft")) { sGestureText = "FlyLeft"; } else if (sGestureText.Equals("SwipeRight")) { sGestureText = "FlyRight"; } GestureInfo2.text = "Gesture : " + sGestureText; } if (gesture == KinectGestures.Gestures.SwipeLeft) { swipeLeft = true; } else if (gesture == KinectGestures.Gestures.SwipeRight) { swipeRight = true; } else if (gesture == KinectGestures.Gestures.SwipeUp) { swipeUp = true; } else if (gesture == KinectGestures.Gestures.SwipeDown) { swipeDown = true; } else if (gesture == KinectGestures.Gestures.FlyLeft) { flyLeft = true; } else if (gesture == KinectGestures.Gestures.FlyRight) { flyRight = true; } else if (gesture == KinectGestures.Gestures.FlyMiddle) { flyMiddle = true; } else if (gesture == KinectGestures.Gestures.Flap) { Flap = true; } else if (gesture == KinectGestures.Gestures.Squat) { Squat = true; } else if (gesture == KinectGestures.Gestures.RaiseLeftHand) { raiseLeftHand = true; } else if (gesture == KinectGestures.Gestures.RaiseRightHand) { raiseRightHand = true; } return(true); }
public void GestureInProgress(uint userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos) { //throw new System.NotImplementedException(); }
public bool GestureCancelled(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.SkeletonJoint joint) { // throw new System.NotImplementedException(); return(true); }
public void GestureInProgress(uint userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectWrapper.SkeletonJoint joint, Vector3 screenPos) { // criar procedimentos para verificar se um gesto está sendo executado sem ter finalizado. // throw new System.NotImplementedException(); }
public bool GestureCancelled(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint) { throw new NotImplementedException(); }
public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectInterop.JointType joint, Vector3 screenPos) { throw new NotImplementedException(); }
public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint, Vector3 screenPos) { //throw new NotImplementedException(); return(true); }
public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, JointType joint, Vector3 screenPos) { // don't do anything here }
public void GestureInProgress(uint userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos) { //GestureInfo.guiText.text = string.Format("{0} Progress: {1:F1}%", gesture, (progress * 100)); if (gesture == KinectGestures.Gestures.Click && progress > 0.3f) { string sGestureText = "";// string.Format ("{0} {1:F1}% complete", gesture, progress * 100); if (MouseInfo != null) { if (gesture == KinectGestures.Gestures.Click) { if (progress < 0.2) { sGestureText = " 5"; } else if (progress < 0.4) { sGestureText = "4"; } else if (progress < 0.6) { sGestureText = "3"; } else if (progress < 0.8) { sGestureText = "2"; } else if (progress < 0.85) { sGestureText = "1"; } else if (progress < 0.99) { sGestureText = "0"; } else { sGestureText = ""; } MouseInfo.GetComponent <TextMeshProUGUI>().text = sGestureText; } } progressDisplayed = true; } else if ((gesture == KinectGestures.Gestures.ZoomOut || gesture == KinectGestures.Gestures.ZoomIn) && progress > 0.5f) { string sGestureText = string.Format("{0} detected, zoom={1:F1}%", gesture, screenPos.z * 100); if (GestureInfo != null) { GestureInfo.GetComponent <TextMeshProUGUI>().text = sGestureText; } progressDisplayed = true; } else if (gesture == KinectGestures.Gestures.Wheel && progress > 0.5f) { string sGestureText = string.Format("{0} detected, angle={1:F1} deg", gesture, screenPos.z); if (GestureInfo != null) { GestureInfo.GetComponent <TextMeshProUGUI>().text = sGestureText; } progressDisplayed = true; } }
public bool GestureCancelled(long userId, int userIndex, KinectGestures.Gestures gesture, Windows.Kinect.JointType joint) { return(true); }
/// <summary> /// Invoked when a gesture is in progress. /// </summary> /// <param name="userId">User ID</param> /// <param name="userIndex">User index</param> /// <param name="gesture">Gesture type</param> /// <param name="progress">Gesture progress [0..1]</param> /// <param name="joint">Joint type</param> /// <param name="screenPos">Normalized viewport position</param> public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectInterop.JointType joint, Vector3 screenPos) { // the gestures are allowed for the primary user only if (userIndex != playerIndex) { return; } if (gesture == KinectGestures.Gestures.ZoomOut) { if (progress > 0.5f) { zoomOut = true; zoomFactor = screenPos.z; if (gestureInfo != null) { string sGestureText = string.Format("{0} factor: {1:F0}%", gesture, screenPos.z * 100f); gestureInfo.text = sGestureText; progressDisplayed = true; progressGestureTime = Time.realtimeSinceStartup; } } else { zoomOut = false; } } else if (gesture == KinectGestures.Gestures.ZoomIn) { if (progress > 0.5f) { zoomIn = true; zoomFactor = screenPos.z; if (gestureInfo != null) { string sGestureText = string.Format("{0} factor: {1:F0}%", gesture, screenPos.z * 100f); gestureInfo.text = sGestureText; progressDisplayed = true; progressGestureTime = Time.realtimeSinceStartup; } } else { zoomIn = false; } } else if (gesture == KinectGestures.Gestures.Wheel) { if (progress > 0.5f) { wheel = true; wheelAngle = screenPos.z; if (gestureInfo != null) { string sGestureText = string.Format("Wheel angle: {0:F0} deg.", screenPos.z); gestureInfo.text = sGestureText; progressDisplayed = true; progressGestureTime = Time.realtimeSinceStartup; } } else { wheel = false; } } }
void KinectGestures.GestureListenerInterface.GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectInterop.JointType joint, Vector3 screenPos) { if (CusKincetManager.Instance.mPlayerIndex != userIndex) { return; } var rhState = KinectManager.Instance.GetRightHandState(userId); if (rhState == KinectInterop.HandState.Closed && !bIsStartPlayVideo) { if (mImageProgress < mHoverTime) { SetGameObjectActive(circleParent, true); mImageProgress += Time.deltaTime; mTimerImage.fillAmount = mImageProgress / mHoverTime; bIsStartPlayVideo = false; } else { CheckUserInputInfo(eState.eStart); SetGameObjectActive(circleParent, false); mImageProgress = 0f; bIsStartPlayVideo = true; VideoPlayfromStart(); return; } } else if (bIsStartPlayVideo || rhState != KinectInterop.HandState.Closed) { if (mImageProgress > 0) { SetGameObjectActive(circleParent, true); mImageProgress -= Time.deltaTime * 2.5f; } else { //CheckUserInputInfo(eState.eWaitStart); SetGameObjectActive(circleParent, false); mImageProgress = 0f; bIsStartPlayVideo = false; } } }
bool KinectGestures.GestureListenerInterface.GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint, Vector3 screenPos) { //只处理第一个玩家。 if (CusKincetManager.Instance.mPlayerIndex != userIndex) { return(false); } if (joint == KinectInterop.JointType.HandRight) { mCursor.rectTransform.position = screenPos; } if (gesture == KinectGestures.Gestures.SwipeLeft) { Debug.Log("swipeleft is complete.."); //this.CheckUserInputInfo(); } return(true); }
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos) { string sGestureText = gesture + " Detectado"; if (GestureInfo != null) { GestureInfo.GetComponent <GUIText>().text = sGestureText; } if (gesture == KinectGestures.Gestures.Musibidachi) { Musibidachi = true; contador1++; Debug.Log(contador1); ActualizarContador(); } else if (gesture == KinectGestures.Gestures.Joe) { Joe = true; contador2++; ActualizarContador(); } else if (gesture == KinectGestures.Gestures.Zenkutsu) { Zenkutsu = true; contador3++; ActualizarContador(); } else if (gesture == KinectGestures.Gestures.Kokutsu) { Kokutsu = true; contador4++; ActualizarContador(); } else if (gesture == KinectGestures.Gestures.Tsuki) { Tsuki = true; contador5++; ActualizarContador(); } else if (gesture == KinectGestures.Gestures.OiZuki) { OiZuki = true; contador6++; ActualizarContador(); } else if (gesture == KinectGestures.Gestures.Uke) { Uke = true; contador7++; ActualizarContador(); } else if (gesture == KinectGestures.Gestures.AgeUke) { AgeUke = true; contador8++; ActualizarContador(); } if (MovActual == 1 && contador1 == 3) { Debug.Log("Musi Completo"); LoginController.Movimiento = 2; ActualizarMovimiento(1); DestroyImmediate(Camera.main.gameObject); SceneManager.LoadScene(SceneManager.GetActiveScene().name); } else if (MovActual == 2 && contador2 == 3) { LoginController.Movimiento = 3; ActualizarMovimiento(2); DestroyImmediate(Camera.main.gameObject); SceneManager.LoadScene(SceneManager.GetActiveScene().name); } else if (MovActual == 3 && contador3 == 3) { LoginController.Movimiento = 4; ActualizarMovimiento(3); DestroyImmediate(Camera.main.gameObject); SceneManager.LoadScene(SceneManager.GetActiveScene().name); } else if (MovActual == 4 && contador4 == 3) { LoginController.Movimiento = 5; ActualizarMovimiento(4); DestroyImmediate(Camera.main.gameObject); SceneManager.LoadScene(SceneManager.GetActiveScene().name); } else if (MovActual == 5 && contador5 == 3) { LoginController.Movimiento = 6; ActualizarMovimiento(5); DestroyImmediate(Camera.main.gameObject); SceneManager.LoadScene(SceneManager.GetActiveScene().name); } else if (MovActual == 6 && contador6 == 3) { LoginController.Movimiento = 7; ActualizarMovimiento(6); DestroyImmediate(Camera.main.gameObject); SceneManager.LoadScene(SceneManager.GetActiveScene().name); } else if (MovActual == 7 && contador7 == 3) { LoginController.Movimiento = 8; ActualizarMovimiento(7); DestroyImmediate(Camera.main.gameObject); SceneManager.LoadScene(SceneManager.GetActiveScene().name); } else if (MovActual == 8 && contador8 == 3) { ActualizarMovimiento(8); DestroyImmediate(Camera.main.gameObject); SceneManager.LoadScene("ModulosEntrenamiento"); } return(true); }
/// <summary> /// Invoked when a gesture is in progress. /// </summary> /// <param name="userId">User ID</param> /// <param name="userIndex">User index</param> /// <param name="gesture">Gesture type</param> /// <param name="progress">Gesture progress [0..1]</param> /// <param name="joint">Joint type</param> /// <param name="screenPos">Normalized viewport position</param> public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectInterop.JointType joint, Vector3 screenPos) { // the gestures are allowed for the primary user only sGestureText = gesture + " detected"; if (userIndex != playerIndex) return; if((gesture == KinectGestures.Gestures.Wheel || gesture == KinectGestures.Gestures.LeanLeft || gesture == KinectGestures.Gestures.LeanRight || gesture == KinectGestures.Gestures.LeanForward || gesture == KinectGestures.Gestures.LeanBack) && progress > 0.01f) { if(gestureInfo != null) { sGestureText = string.Format ("{0} - {1:F0} degrees", gesture, screenPos.z); gestureInfo.text = sGestureText; if (gesture == KinectGestures.Gestures.LeanLeft && screenPos.z > detectSense) { LeanLeft = true; } else { LeanLeft = false; } if (gesture == KinectGestures.Gestures.LeanRight && screenPos.z > detectSense) { LeanRight = true; }else { LeanRight = false; } if (gesture == KinectGestures.Gestures.LeanForward && screenPos.z > detectSense) { LeanForward = true; } else { LeanForward = false; } if (gesture == KinectGestures.Gestures.LeanBack && screenPos.z > detectSense + 10) { LeanBack = true; } else { LeanBack = false; } progressDisplayed = true; progressGestureTime = Time.realtimeSinceStartup; } } }
/// <summary> /// Invoked when a gesture is in progress. /// </summary> /// <param name="userId">User ID</param> /// <param name="userIndex">User index</param> /// <param name="gesture">Gesture type</param> /// <param name="progress">Gesture progress [0..1]</param> /// <param name="joint">Joint type</param> /// <param name="screenPos">Normalized viewport position</param> public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectInterop.JointType joint, Vector3 screenPos) { // the gestures are allowed for the primary user only KinectManager manager = KinectManager.Instance; if (!manager || (userId != manager.GetPrimaryUserID())) { return; } /* if(gesture == KinectGestures.Gestures.ZoomOut) * { * if(progress > 0.5f) * { * zoomOut = true; * zoomFactor = screenPos.z; * * if(gestureInfo != null) * { * string sGestureText = string.Format ("{0} - {1:F0}%", gesture, screenPos.z * 100f); * gestureInfo.GetComponent<Text>().text = sGestureText; * * progressDisplayed = true; * progressGestureTime = Time.realtimeSinceStartup; * } * } * else * { * zoomOut = false; * } * } * else if(gesture == KinectGestures.Gestures.ZoomIn) * { * if(progress > 0.5f) * { * zoomIn = true; * zoomFactor = screenPos.z; * * if(gestureInfo != null) * { * string sGestureText = string.Format ("{0} factor: {1:F0}%", gesture, screenPos.z * 100f); * gestureInfo.GetComponent<Text>().text = sGestureText; * * progressDisplayed = true; * progressGestureTime = Time.realtimeSinceStartup; * } * } * else * { * zoomIn = false; * } * } * else */if (gesture == KinectGestures.Gestures.Wheel) { if (progress > 0.5f) { wheel = true; wheelAngle = screenPos.z; if (gestureInfo != null) { string sGestureText = string.Format("Wheel angle: {0:F0} degrees", screenPos.z); gestureInfo.GetComponent <Text>().text = sGestureText; progressDisplayed = true; progressGestureTime = Time.realtimeSinceStartup; } } else { wheel = false; } } else if (gesture == KinectGestures.Gestures.Bow) { if (progress > 0.5f) { bow = true; bowFactor = screenPos.z; if (gestureInfo != null) { string sGestureText = string.Format("Bow Factor: {0:F3} degrees", screenPos.z); gestureInfo.GetComponent <Text>().text = sGestureText; progressDisplayed = true; progressGestureTime = Time.realtimeSinceStartup; } } else { bow = false; } } }
public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectInterop.JointType joint, Vector3 screenPos) { if (Test.Instance.isMid) { if (gesture == KinectGestures.Gestures.ZoomIn) { if (progress > 0.5f && cubeTrans.localScale.x <= 5) { cubeTrans.localScale += Vector3.one * 0.1f * screenPos.z; print(screenPos); } } else if (gesture == KinectGestures.Gestures.ZoomOut) { if (progress > 0.5f && cubeTrans.localScale.x >= 0.5f) { cubeTrans.localScale -= Vector3.one * 0.1f * screenPos.z; print(screenPos); } } else if (gesture == KinectGestures.Gestures.Wheel) { if (progress > 0.5f) { if (Mathf.Abs(screenPos.z) > 1) { text.text = "Wheel"; cubeTrans.Rotate(screenPos * 0.1f); } } } else if (gesture == KinectGestures.Gestures.ShoulderLeftFront) { text.text = "左肩向前!"; } else if (gesture == KinectGestures.Gestures.ShoulderRightFront) { text.text = "右肩向前!"; } else if (gesture == KinectGestures.Gestures.LeanLeft) { text.text = "左倾!"; } else if (gesture == KinectGestures.Gestures.LeanRight) { text.text = "右倾!"; } else if (gesture == KinectGestures.Gestures.LeanForward) { text.text = "前倾!"; } else if (gesture == KinectGestures.Gestures.LeanBack) { text.text = "后倾!"; } else if (gesture == KinectGestures.Gestures.KickLeft) { text.text = "左脚前踢!"; } else if (gesture == KinectGestures.Gestures.KickRight) { text.text = "右脚前踢!"; } } else { text.text = "丢失玩家!"; } }
public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint, Vector3 screenPos) { return(true); }
public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint, Vector3 screenPos) { if (Test.Instance.isMid) { if (gesture == KinectGestures.Gestures.RaiseLeftHand) { text.text = "举起了左手!"; isRaiseLeftHand = true; } else if (gesture == KinectGestures.Gestures.RaiseRightHand) { text.text = "举起了右手!"; isRaiseRightHand = true; } else if (gesture == KinectGestures.Gestures.Psi) { text.text = "投降!"; isPsi = true; } else if (gesture == KinectGestures.Gestures.Stop) { text.text = "停!"; isStop = true; } else if (gesture == KinectGestures.Gestures.Tpose) { text.text = "T!"; isTpose = true; } else if (gesture == KinectGestures.Gestures.Wave) { text.text = "Wave!"; isWave = true; } else if (gesture == KinectGestures.Gestures.SwipeLeft) { isSwipeLeft = true; cubeTrans.DORotate(cubeTrans.position + new Vector3(0, 90, 0), 1).SetEase(Ease.Linear); } else if (gesture == KinectGestures.Gestures.SwipeRight) { isSwipeRight = true; cubeTrans.DORotate(cubeTrans.position + new Vector3(0, -90, 0), 1).SetEase(Ease.Linear); } else if (gesture == KinectGestures.Gestures.SwipeUp) { isSwipeUP = true; cubeTrans.DORotate(cubeTrans.position + new Vector3(90, 0, 0), 1).SetEase(Ease.Linear); } else if (gesture == KinectGestures.Gestures.SwipeDown) { isSwipeDown = true; cubeTrans.DORotate(cubeTrans.position - new Vector3(90, 0, 0), 1).SetEase(Ease.Linear); } else if (gesture == KinectGestures.Gestures.Jump) { text.text = "跳!"; } else if (gesture == KinectGestures.Gestures.Squat) { text.text = "蹲!"; } else if (gesture == KinectGestures.Gestures.Pull) { text.text = "拉!"; } else if (gesture == KinectGestures.Gestures.Push) { text.text = "推!"; } else if (gesture == KinectGestures.Gestures.RaisedLeftHorizontalRightHand) { text.text = "举左手右手水平!"; } else if (gesture == KinectGestures.Gestures.RaisedRightHorizontalLeftHand) { text.text = "举右手左手水平!"; } } else { text.text = "丢失玩家!"; } return(true); }
public bool GestureCancelled(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint) { return(true); }
public bool GestureCancelled(long userId, int userIndex, KinectGestures.Gestures gesture, JointType joint) { // don't do anything here, just reset the gesture state return(true); }
public void GestureInProgress(uint userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos) { }
/// <summary> /// 当一个手势识别完成后被调用 /// </summary> /// <returns>true</returns> /// <c>false</c> /// <param name="userId">被识别者的ID</param> /// <param name="userIndex">被识别者的序号</param> /// <param name="gesture">被识别到的手势类型</param> /// <param name="joint">被识别到的关节类型</param> /// <param name="screenPos">视图坐标的单位向量</param> public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint, Vector3 screenPos) { if (progressDisplayed) { return(true); } string sGestureText = gesture + " detected"; if (gestureInfo != null) { gestureInfo.GetComponent <Text>().text = sGestureText; } // 可以在这里写识别到的所有手势,完成之后去调用某个方法, // 但为了右面可能不止一个场景可能使用到相同的手势,所以使用bool跳出去,在使用到的时候去写完成动作之后的方法 switch (gesture) { case KinectGestures.Gestures.None: break; case KinectGestures.Gestures.RaiseRightHand: RaiseRightHand = true; break; case KinectGestures.Gestures.RaiseLeftHand: RaiseLeftHand = true; break; case KinectGestures.Gestures.Psi: Psi = true; break; case KinectGestures.Gestures.Tpose: Tpose = true; break; case KinectGestures.Gestures.Stop: Stop = true; break; case KinectGestures.Gestures.Wave: Wave = true; break; case KinectGestures.Gestures.SwipeLeft: SwipeLeft = true; break; case KinectGestures.Gestures.SwipeRight: SwipeRight = true; break; case KinectGestures.Gestures.SwipeUp: SwipeUp = true; break; case KinectGestures.Gestures.SwipeDown: SwipeDown = true; break; case KinectGestures.Gestures.ZoomIn: ZoomIn = true; break; case KinectGestures.Gestures.ZoomOut: ZoomOut = true; break; case KinectGestures.Gestures.Wheel: Wheel = true; break; case KinectGestures.Gestures.Jump: Jump = true; break; case KinectGestures.Gestures.Squat: Squat = true; break; case KinectGestures.Gestures.Push: Push = true; break; case KinectGestures.Gestures.Pull: Pull = true; break; case KinectGestures.Gestures.ShoulderLeftFront: break; case KinectGestures.Gestures.ShoulderRightFront: break; case KinectGestures.Gestures.LeanLeft: break; case KinectGestures.Gestures.LeanRight: break; case KinectGestures.Gestures.LeanForward: break; case KinectGestures.Gestures.LeanBack: break; case KinectGestures.Gestures.KickLeft: break; case KinectGestures.Gestures.KickRight: break; case KinectGestures.Gestures.Run: break; case KinectGestures.Gestures.RaisedRightHorizontalLeftHand: break; case KinectGestures.Gestures.RaisedLeftHorizontalRightHand: break; case KinectGestures.Gestures.UserGesture1: break; case KinectGestures.Gestures.UserGesture2: break; case KinectGestures.Gestures.UserGesture3: break; case KinectGestures.Gestures.UserGesture4: break; case KinectGestures.Gestures.UserGesture5: break; case KinectGestures.Gestures.UserGesture6: break; case KinectGestures.Gestures.UserGesture7: break; case KinectGestures.Gestures.UserGesture8: break; case KinectGestures.Gestures.UserGesture9: break; case KinectGestures.Gestures.UserGesture10: break; default: break; } return(true); }