예제 #1
0
        public void DebugGoals()
        {
            //BodyManager bodyManager = new BodyManager();
            //foreach (var body in bodyManager.BodyMap.Values)
            //{
            //    body.transform.GetChild()
            //}

            List <Windows.Kinect.JointType> goalJointTypesList = GetValidGoalJointsList();
            List <Windows.Kinect.Joint>     goalJointsList     = new List <Windows.Kinect.Joint>();

            for (int i = 0; i < goalJointTypesList.Count; i++)
            {
                Windows.Kinect.JointType jt = goalJointTypesList[i];
                Windows.Kinect.Joint     j  = bodyManager.GetJoint(jt);
                goalJointsList.Add(j);

                GameObject jointObj        = bodyManager.GetJointObject(jt);
                bool       goalMetForJoint = goalManager.GoalMet(j);
                if (goalMetForJoint)
                {
                    Debug.Log("Joint[" + jt.ToString() + "] Goal Met!");
                }
            }

            if (goalManager.AllGoalsMet(goalJointsList))
            {
                Debug.Log("SUCCESS: All joint goals met!");
            }
        }
예제 #2
0
파일: Body.cs 프로젝트: dn9090/de.htw.cave
        public void RefreshJointOrientationsFast(Dictionary <JointType, JointOrientation> jointOrientations)
        {
            if (_pNative == IntPtr.Zero)
            {
                throw new ObjectDisposedException("Body");
            }

            int length = Windows_Kinect_Body_get_JointOrientations_Length(_pNative);
            var keys   = new Windows.Kinect.JointType[length];
            var values = new Windows.Kinect.JointOrientation[length];

            length = Windows_Kinect_Body_get_JointOrientations(_pNative, keys, values, length);

            jointOrientations.Clear();

            for (int i = 0; i < length; i++)
            {
                jointOrientations.Add(keys[i], values[i]);
            }
        }
예제 #3
0
    void RefreshBodyObject(Windows.Kinect.Body body)
    {
        bool isGen = false;

        if (tt.Count - 1 != (int)Windows.Kinect.JointType.ThumbRight)
        {
            tt.Clear();
            isGen = true;
            print("ボーンを生成します.");
        }

        for (Windows.Kinect.JointType jt = Windows.Kinect.JointType.SpineBase; jt <= Windows.Kinect.JointType.ThumbRight; jt++)
        {
            Windows.Kinect.Joint sourceJoint = body.Joints[jt];
            Vector3 tmp = GetVector3FromJoint(sourceJoint) * 20;
            if (isGen)
            {
                var t = GameObject.CreatePrimitive(PrimitiveType.Cube).transform;
                t.name     = jt.ToString();
                t.position = tmp;
                t.parent   = transform;
                Destroy(t.GetComponent <BoxCollider>());
                tt.Add(t);
            }
            else
            {
                Transform t = tt[(int)jt];
                if (sourceJoint.TrackingState == Windows.Kinect.TrackingState.Tracked)
                {
                    t.position = tmp;
                    // t.gameObject.SetActive(true);
                }
                else
                {
                    // t.gameObject.SetActive(false);
                }
            }
        }
    }
예제 #4
0
 public bool GestureCancelled(long userId, int userIndex, KinectGestures.Gestures gesture, Windows.Kinect.JointType joint)
 {
     return(true);
 }
예제 #5
0
 public bool GestureCompleted(long userId, int userIndex, KinectGestures.Gestures gesture, Windows.Kinect.JointType joint, Vector3 screenPos)
 {
     if (gesture == KinectGestures.Gestures.MySquat)
     {
         SquatDet = true;
     }
     if (gesture == KinectGestures.Gestures.Myjump)
     {
         JumpDet = true;
     }
     if (gesture == KinectGestures.Gestures.Walk)
     {
         RunDet      = true;
         RunAnimFlag = true;
         if (bPause)
         {
             bPause = false;
             Continue();
         }
         if (GUImanager.bOkToRestart)
         {
             bOkToRestartAndRunDet = true;
         }
         if (Time.timeScale != 1)
         {
             Time.timeScale = 1;
             zanTing.gameObject.SetActive(false);
         }
     }
     if (gesture == KinectGestures.Gestures.MyMoveLeft)
     {
         leftMovePro = 0;
         MoveLeftDet = true;
     }
     if (gesture == KinectGestures.Gestures.MyMoveRight)
     {
         rightMovePro = 0;
         MoveRightDet = true;
     }
     if (gesture == KinectGestures.Gestures.MyRaiseUpLeft)
     {
         Time.timeScale = 0;
         zanTing.gameObject.SetActive(true);
         bPause = true;
     }
     // }
     return(true);
 }
예제 #6
0
 public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture, float progress, Windows.Kinect.JointType joint, Vector3 screenPos)
 {
 }
예제 #7
0
 public Map(Windows.Kinect.JointType type, UnityEngine.Transform bone)
 {
     this.Type             = type;
     this.Bone             = bone;
     this.AdjustmentToMesh = Quaternion.identity;
 }