public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.SkeletonJoint joint, Vector3 screenPos) { KinectManager manager = KinectManager.Instance; string sGestureText = gesture + " detected"; if(GestureInfo != null) { GestureInfo.guiText.text = sGestureText; } if (gesture == KinectGestures.Gestures.SwipeLeft) swipeLeft = true; else if (gesture == KinectGestures.Gestures.SwipeRight) swipeRight = true; //else if(gesture == KinectGestures.Gestures.RaiseLeftHand) // RaiseLeftHand = true; //else if(gesture == KinectGestures.Gestures.RaiseRightHand) // RaiseRightHand = true; else if (gesture == KinectGestures.Gestures.Push) Push = true; else if (gesture == KinectGestures.Gestures.Psi) PSI = true; else if (gesture == KinectGestures.Gestures.Wave) Wave = true; return true; }
public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectInterop.JointType joint, Vector3 screenPos) { /*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.text = sGestureText; } //Debug.Log(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.text = sGestureText; } //Debug.Log(sGestureText); progressDisplayed = true; }*/ }
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos) { string sGestureText = gesture + " detected"; if(GestureInfo != null) { GestureInfo.guiText.text = sGestureText; } if(gesture == KinectGestures.Gestures.SwipeLeft) { swipeLeft = true; } if(gesture == KinectGestures.Gestures.SwipeRight) { swipeRight = true; } if(gesture == KinectGestures.Gestures.SwipeUp) { swipeUp = true; } if(gesture == KinectGestures.Gestures.SwipeDown) { swipeDown = true; } if(gesture == KinectGestures.Gestures.Push) { push = true; } if(gesture == KinectGestures.Gestures.Pull) { pull = true; } return true; }
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 || 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<GUIText>().text = sGestureText; } //Debug.Log(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<GUIText>().text = sGestureText; } //Debug.Log(sGestureText); progressDisplayed = true; } }
// Start is called before the first frame update void Start() { KinectManager = KinectManager.Instance; KinectGestures = GetComponent <KinectGestures>(); Rigidbody = GetComponent <Rigidbody>(); InitialPos = transform.position; }
public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint, Vector3 screenPos) { //string sGestureText = gesture + " detected"; //if(GestureInfo != null) //{ // GestureInfo.guiText.text = sGestureText; //} if (gesture == KinectGestures.Gestures.Squat) { int num = 0; Camera.main.transform.SendMessage ("ActionPerformed",num); } else if (gesture == KinectGestures.Gestures.Jump) { Camera.main.transform.SendMessage ("ActionPerformed",1); } else if (gesture == KinectGestures.Gestures.Wave) { Camera.main.transform.SendMessage ("ActionPerformed",2); } else if (gesture == KinectGestures.Gestures.RaiseLeftHand) { Camera.main.transform.SendMessage ("ActionPerformed",3); } else if (gesture == KinectGestures.Gestures.RaiseRightHand) { Camera.main.transform.SendMessage ("ActionPerformed",4); } return true; }
//Virtual override of KinectGestures.GestureListenerInterface.GestureCompleted //Once completed a gesture propogate the gesture to the GestureNavigationMenu public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint, Vector3 screenPos) { string sGestureText = gesture + " detected"; if(GestureInfo != null) { GestureInfo.text = sGestureText; } //depending on which gesture is performed, call the relevant function in the GestureNavigationMenu switch (gesture) { case KinectGestures.Gestures.SwipeUp: menu.SwipeUp(); break; case KinectGestures.Gestures.SwipeDown: menu.SwipeDown(); break; case KinectGestures.Gestures.SwipeLeft: menu.SwipeLeft(); break; case KinectGestures.Gestures.SwipeRight: menu.SwipeRight(); break; default: break; } progressDisplayed = false; return true; }
public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectInterop.JointType joint, Vector3 screenPos) { if((gesture == KinectGestures.Gestures.ZoomOut || gesture == KinectGestures.Gestures.ZoomIn) && progress > 0.5f) { string sGestureText = string.Format ("{0} {1:F0}%", gesture, screenPos.z * 100f); if(GestureInfo != null) { GestureInfo.GetComponent<GUIText>().text = sGestureText; } progressDisplayed = true; progressGestureTime = Time.realtimeSinceStartup; } else if(gesture == KinectGestures.Gestures.Wheel && progress > 0.5f) { string sGestureText = string.Format ("{0} {1:F0} deg.", gesture, screenPos.z); if(GestureInfo != null) { GestureInfo.GetComponent<GUIText>().text = sGestureText; } //Debug.Log(sGestureText); progressDisplayed = true; progressGestureTime = Time.realtimeSinceStartup; } }
public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, JointType 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(GestureInfo != null) // GestureInfo.guiText.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.guiText.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.guiText.text = sGestureText; progressDisplayed = true; } }
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; // this function is currently needed only to display gesture progress, skip it otherwise if(gestureInfo == null) return; if((gesture == KinectGestures.Gestures.ZoomOut || gesture == KinectGestures.Gestures.ZoomIn) && progress > 0.5f) { string sGestureText = string.Format ("{0} {1:F0}%", gesture, screenPos.z * 100f); gestureInfo.GetComponent<GUIText>().text = sGestureText; progressDisplayed = true; progressGestureTime = Time.realtimeSinceStartup; } else if(gesture == KinectGestures.Gestures.Wheel && progress > 0.5f) { string sGestureText = string.Format ("{0} {1:F0} degrees", gesture, screenPos.z); gestureInfo.GetComponent<GUIText>().text = sGestureText; //Debug.Log(sGestureText); progressDisplayed = true; progressGestureTime = Time.realtimeSinceStartup; } }
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos) { string sGestureText = gesture + " detected"; if (gesture == KinectGestures.Gestures.Click) { sGestureText += string.Format (" at ({0:F1}, {1:F1})", screenPos.x, screenPos.y); print ("CLICKED DOWN???!?!?!?!?!"); //reverse units print ("SCREEN POS: " + screenPos); clickedPos.x = screenPos.x; clickedPos.y = screenPos.y; GetComponent<LineGame> ().kinectClickedOn = true; GetComponent<LineGame> ().clickedPos = clickedPos; GetComponent<Main> ().kinectClickedOn = true; GetComponent<Main> ().clickedPos = clickedPos; GetComponent<GrowingTeamGame> ().kinectClickedOn = true; GetComponent<GrowingTeamGame> ().clickedPos = clickedPos; GetComponent<AquariumGame> ().kinectClickedOn = true; GetComponent<AquariumGame> ().clickedPos = clickedPos; } if(GestureInfo != null) GestureInfo.GetComponent<GUIText>().text = sGestureText; progressDisplayed = false; return true; }
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(GestureInfo != null) GestureInfo.GetComponent<GUIText>().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<GUIText>().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<GUIText>().text = sGestureText; progressDisplayed = true; } }
public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint, Vector3 screenPos) { string sGestureText = gesture + " detected"; if(GestureInfo != null) { GestureInfo.text = sGestureText; } switch (gesture) { case KinectGestures.Gestures.SwipeUp: menu.SwipeUp(); break; case KinectGestures.Gestures.SwipeDown: menu.SwipeDown(); break; case KinectGestures.Gestures.SwipeLeft: menu.SwipeLeft(); break; case KinectGestures.Gestures.SwipeRight: menu.SwipeRight(); break; default: break; } progressDisplayed = false; return true; }
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos) { if (gesture == KinectGestures.Gestures.SwipeLeft && Cart.scene2) { Debug.Log("Swipe Left Completed!"); GameObject.FindObjectOfType<Shelf>().SwipeLeft(); } if (gesture == KinectGestures.Gestures.SwipeRight && Cart.scene2) { //Debug.Log("Swipe Left Completed!"); GameObject.FindObjectOfType<Cart>().SwipeRight(); Debug.Log("Swipe Right Completed!"); } string sGestureText = gesture + " detected"; if(gesture == KinectGestures.Gestures.Click) sGestureText += string.Format(" at ({0:F1}, {1:F1})", screenPos.x, screenPos.y); if(GestureInfo != null) GestureInfo.GetComponent<GUIText>().text = sGestureText; progressDisplayed = false; return true; }
/// <summary> /// Invoked if a gesture is cancelled. /// </summary> /// <returns>true</returns> /// <c>false</c> /// <param name="userId">User ID</param> /// <param name="userIndex">User index</param> /// <param name="gesture">Gesture type</param> /// <param name="joint">Joint type</param> public bool GestureCancelled(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint) { // the gestures are allowed for the primary user only KinectManager manager = KinectManager.Instance; if(!manager || (userId != manager.GetPrimaryUserID())) return false; if(gesture == KinectGestures.Gestures.LeanLeft) { leanLeft = false; } else if(gesture == KinectGestures.Gestures.LeanRight) { leanRight = false; } else if(gesture == KinectGestures.Gestures.Wheel) { wheel = false; } if(gestureInfo != null && progressDisplayed) { progressDisplayed = false; gestureInfo.GetComponent<GUIText>().text = "Lean-left, Lean-right to rotate the Room."; } return true; }
//KinectGestures.GestureListenerInterface virtual implementation public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint, Vector3 screenPos) { string sGestureText = gesture + " detected"; //Propogate the recognised gesture to the cursor controller if(cursor!=null)cursor.WaveRecognised(); if(cursorDirect!=null)cursorDirect.WaveRecognised(); return true; }
public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint, Vector3 screenPos) { if (activeGestures.ContainsKey(userId)) activeGestures[userId].Enqueue(gesture); return true; // this true return will clear the gesture info, because once we've completed one gesture, // we assume that any others started at the same time were actually just misinterpretations. }
public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, JointType joint, Vector3 screenPos) { if (gesture == KinectGestures.Gestures.RaiseRightHand) { StateManager.Instance.IsPlaying = true; StateManager.Instance.CurrentState = StateManager.State.PLAYING; } return true; }
public bool GestureCancelled(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint) { // the gestures are allowed for the primary user only KinectManager manager = KinectManager.Instance; if(!manager || (userId != manager.GetPrimaryUserID())) return false; // 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) { if (gesture == KinectGestures.Gestures.SwipeLeft) { //Debug.Log("SwipeLeft " + progress + " Screen Pos: "+ screenPos + " Gesture: " + gesture); } if (gesture == KinectGestures.Gestures.SwipeRight) { //Debug.Log("SwipeRight " + progress + " Screen Pos: "+ screenPos + " Gesture: " + gesture); } }
static void Main(string[] args) { #region TO be Removed IntPtr hWnd = Process.GetCurrentProcess().MainWindowHandle; SetWindowPos(hWnd, new IntPtr(HWND_TOPMOST), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); #endregion //KinectControl kController = new KinectControl(); KinectGestures kGestures = new KinectGestures(); Console.ReadKey(); }
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos) { string sGestureText = gesture + " detected"; if(gesture == KinectGestures.Gestures.Click) sGestureText += string.Format(" at ({0:F1}, {1:F1})", screenPos.x, screenPos.y); if(GestureInfo != null) GestureInfo.GetComponent<GUIText>().text = sGestureText; progressDisplayed = false; return true; }
public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint, Vector3 screenPos) { string sGestureText = gesture + " detected"; if(GestureInfo != null) { GestureInfo.guiText.text = sGestureText; } progressDisplayed = false; return true; }
public bool GestureCancelled(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint) { if(progressDisplayed) { // clear the progress info if(GestureInfo != null) GestureInfo.GetComponent<GUIText>().text = String.Empty; progressDisplayed = false; } return true; }
public bool GestureCancelled(long userId, int userIndex, KinectGestures.Gestures gesture, JointType joint) { if(progressDisplayed) { // clear the progress info if(GestureInfo != null) GestureInfo.guiText.text = String.Empty; progressDisplayed = false; } return true; }
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<GUIText>().text = sGestureText; } return true; }
public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, JointType joint, Vector3 screenPos) { string sGestureText = gesture + " detected"; // if(gesture == KinectGestures.Gestures.Click) // sGestureText += string.Format(" at ({0:F1}, {1:F1})", screenPos.x, screenPos.y); if(GestureInfo != null) GestureInfo.guiText.text = sGestureText; progressDisplayed = false; return true; }
public bool GestureCancelled(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint) { if(progressDisplayed) { progressDisplayed = false; if(GestureInfo != null) { GestureInfo.GetComponent<GUIText>().text = String.Empty; } } return true; }
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos) { string sGestureText = gesture + " detected"; if(GestureInfo != null) { GestureInfo.GetComponent<GUIText>().text = sGestureText; } if(gesture == KinectGestures.Gestures.SwipeLeft) swipeLeft = true; else if(gesture == KinectGestures.Gestures.SwipeRight) swipeRight = true; return true; }
public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint, Vector3 screenPos) { // squat gesture is detected if (gesture == KinectGestures.Gestures.Squat) { SquatNum++; Camera.main.transform.SendMessage ("SquatPerformed"); } // jump or jumping jack gesture is detected else if (gesture == KinectGestures.Gestures.Jump) { JumpNum++; Camera.main.transform.SendMessage ("JumpPerformed"); } return true; }
public bool GestureCancelled(long userId, int userIndex, KinectGestures.Gestures gesture, KinectInterop.JointType joint) { // if(progressDisplayed) // { // // clear the progress info // if(GestureInfo != null) // { // GestureInfo.guiText.text = gesture.ToString(); // } // // progressDisplayed = false; // } return true; }
public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos) { Debug.Log ("A gesture!"); switch (currentRoom) { case Scene.Setup: Debug.Log ("A gesture in setup no less."); currentRoom = Scene.Setup; setupGameController.ReceiveGesture (gesture); break; case Scene.Model_Room: currentRoom = Scene.Model_Room; gameController.ReceiveGesture (gesture); break; } return true; }