Beispiel #1
0
    public void GestureInProgress(uint userId, int userIndex, KinectWrapper.Gestures gesture,
                                  float progress, KinectWrapper.SkeletonJoint joint, Vector3 screenPos)
    {
        //GestureInfo.guiText.text = string.Format("{0} Progress: {1:F1}%", gesture, (progress * 100));
        if (gesture == KinectWrapper.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 == KinectWrapper.Gestures.ZoomOut || gesture == KinectWrapper.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 == KinectWrapper.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;
        }
    }
    // Invoked when a gesture is cancelled.
    public bool GestureCancelled(uint userId, KinectWrapper.Gestures gesture,
                                 KinectWrapper.SkeletonJoint joint)
    {
        if (progressDisplayed)
        {
            // clear the progress info
            if (GestureInfo != null)
            {
                GestureInfo.guiText.text = String.Empty;
            }
            progressDisplayed = false;
        }

        return(true);
    }
    // Invoked when a gesture is complete.
    // Return true, if the gesture must be detected again, false otherwise
    public bool GestureComplete(uint userId, KinectWrapper.Gestures gesture,
                                KinectWrapper.SkeletonJoint joint, Vector3 screenPos)
    {
        string sGestureText = gesture + " detected";

        Debug.Log(sGestureText);
        if (sGestureText == "SwipeLeft detected")
        {
            //GameObject.Find("CubeCloud").animation.Play("CubeCloudTurnLeft");
            GameObject.Find("CubeCloud").GetComponent <CubeCloudGenerator>().turnLeft =
                true;
        }
        else if (sGestureText == "SwipeRight detected")
        {
            GameObject.Find("CubeCloud").animation.Play("CubeCloudTurnRight");
        }
        else if (sGestureText == "RaiseRightHand detected")
        {
            GameObject.Find("CubeCloud").GetComponent <CubeCloudGenerator>().turnLeft =
                false;
        }

        if (gesture == KinectWrapper.Gestures.Click)
        {
            sGestureText += string.Format(" at ({0:F1}, {1:F1})", screenPos.x,
                                          screenPos.y);
            handArea = GameObject.Find("RightHandArea");
            if (handArea.transform.childCount != 0)
            {
                Debug.Log("NOT EMPTY!!!!!!");
                handArea.transform.GetChild(0).gameObject.renderer.material = temp;
                changeableObject = handArea.transform.GetChild(0).gameObject;
            }
            else
            {
                Debug.Log("EMPTY!!");
            }
        }

        if (GestureInfo != null)
        {
            GestureInfo.guiText.text = sGestureText;
        }
        progressDisplayed = false;

        return(true);
    }
Beispiel #4
0
    // Invoked when a gesture is complete.
    // Return true, if the gesture must be detected again, false otherwise
    public bool GestureComplete(uint userId, KinectWrapper.Gestures gesture,
                                KinectWrapper.SkeletonJoint joint, Vector3 screenPos)
    {
        string sGestureText = gesture + " detected";

        if (gesture == KinectWrapper.Gestures.Click)
        {
            sGestureText += string.Format(" at ({0:F1}, {1:F1})", screenPos.x, screenPos.y);
        }

        if (GestureInfo != null)
        {
            GestureInfo.GetComponent <GUIText>().text = sGestureText;
        }

        return(true);
    }
    // Invoked when a gesture is complete.
    // Return true, if the gesture must be detected again, false otherwise
    public bool GestureComplete(uint userId, KinectWrapper.Gestures gesture,
                                KinectWrapper.SkeletonJoint joint, Vector3 screenPos)
    {
        string sGestureText = gesture + " detected";

        if (gesture == KinectWrapper.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);
    }
    // Invoked when a gesture is in progress
    // The gesture must be added first, with KinectManager.Instance.DetectGesture()
    public void GestureInProgress(uint userId, KinectWrapper.Gestures gesture, float progress,
                                  KinectWrapper.SkeletonJoint joint, Vector3 screenPos)
    {
        //GestureInfo.guiText.text = string.Format("{0} Progress: {1:F1}%", gesture, (progress * 100));
        if ((gesture == KinectWrapper.Gestures.RightHandCursor || gesture == KinectWrapper.Gestures.LeftHandCursor) && progress > 0.5f)
        {
//			if(HandCursor != null)
//			{
//				HandCursor.transform.position = Vector3.Lerp(HandCursor.transform.position, screenPos, 3 * Time.deltaTime);
//			}
//
//			string sGestureText = string.Format("{0} - ({1:F1}, {2:F1} {3:F1})", gesture, screenPos.x, screenPos.y, progress * 100);
//			Debug.Log(sGestureText);
        }
        else if (gesture == KinectWrapper.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 == KinectWrapper.Gestures.ZoomOut || gesture == KinectWrapper.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 == KinectWrapper.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;
        }
    }