コード例 #1
0
    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);
    }
コード例 #2
0
    public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
                                 KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
    {
        string sGestureText = gesture + " detected";

        Debug.Log(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.Click)
        {
            click = true;
        }
        else if (gesture == KinectGestures.Gestures.Jump)
        {
            jump = true;
        }
        else if (gesture == KinectGestures.Gestures.Squat)
        {
            squat = true;
        }
        else if (gesture == KinectGestures.Gestures.Tpose)
        {
            tPose = true;
        }

        return(true);
    }
コード例 #3
0
    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;
        }
        else if (gesture == KinectGestures.Gestures.SwipeDown)
        {
            swipeDown = true;
        }
        else if (gesture == KinectGestures.Gestures.SwipeUp)
        {
            swipeUp = true;
        }
        else if (gesture == KinectGestures.Gestures.Click)
        {
            click = true;
        }
        else if (gesture == KinectGestures.Gestures.Wave)
        {
            wave = true;
        }
        else if (gesture == KinectGestures.Gestures.Jump)
        {
            jump = true;
        }
        ContarTempo("");

        return(true);
    }
コード例 #4
0
    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;
            Debug.Log("[제스쳐감지] : " + sGestureText);
        }

//		if (gesture == KinectGestures.Gestures.SwipeLeft)
//			swipeLeft = true;
//		else if (gesture == KinectGestures.Gestures.SwipeRight)
//			swipeRight = true;

        if (gesture == KinectGestures.Gestures.SwingForward)
        {
            swingForward = true;
        }

        if (gesture == KinectGestures.Gestures.SwingBackward)
        {
            swingBackward = true;
        }

        if (gesture == KinectGestures.Gestures.SwingTopdown)
        {
            swingTopDown = true;
        }

        if (gesture == KinectGestures.Gestures.RaiseLeftHand)
        {
            Debug.Log("raise hand");

            startPosition = true;
        }

        setGestureText(gesture);

        return(true);
    }
コード例 #5
0
    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;
         */
        GestureInfo.GetComponent <GUIText> ().text = gesture + "";

        string current_user    = Session_app.current_user;
        string current_machine = Session_app.current_machine;
        string timeString      = currentTime.time.ToString("yyyy-MM-dd HH-mm-ss");;

        if (gesture == KinectGestures.Gestures.Squat)
        {
            //save to database
            Debug.Log("Squat to database");

            // Send User event data to Database
            postJson.PostData(004, current_user, timeString, current_machine);
        }

        if (gesture == KinectGestures.Gestures.Jump)
        {
            //save to database
            Debug.Log("Jump to database");

            //Send User event data to Database
            postJson.PostData(004, current_user, timeString, current_machine);
            Session_app.incorrectPositions++;
            //positionText.GetComponent<GUIText> ().text =  Session_app.incorrectPositions +" Incorrect Positions";
        }

        progressDisplayed = false;

        return(true);
    }
コード例 #6
0
    /*特別な関節あればこっちをつかってる  基本的な用途は上のと同じ*/
    // Apply the rotations tracked by kinect to a special joint
    protected void TransformSpecialBone(uint userId, KinectWrapper.NuiSkeletonPositionIndex joint, KinectWrapper.NuiSkeletonPositionIndex jointParent, int boneIndex, Vector3 baseDir, bool flip)
    {
        Transform boneTransform = bones[boneIndex];

        if (boneTransform == null || kinectManager == null)
        {
            return;
        }

        if (!kinectManager.IsJointTracked(userId, (int)joint) ||
            !kinectManager.IsJointTracked(userId, (int)jointParent))
        {
            return;
        }

        Vector3    jointDir      = kinectManager.GetDirectionBetweenJoints(userId, (int)jointParent, (int)joint, false, true);
        Quaternion jointRotation = jointDir != Vector3.zero ? Quaternion.FromToRotation(baseDir, jointDir) : Quaternion.identity;

//		if(!flip)
//		{
//			Vector3 mirroredAngles = jointRotation.eulerAngles;
//			mirroredAngles.y = -mirroredAngles.y;
//			mirroredAngles.z = -mirroredAngles.z;
//
//			jointRotation = Quaternion.Euler(mirroredAngles);
//		}

        if (jointRotation != Quaternion.identity)
        {
            // Smoothly transition to the new rotation
            Quaternion newRotation = Kinect2AvatarRot(jointRotation, boneIndex);

            if (smoothFactor != 0f)
            {
                boneTransform.rotation = Quaternion.Slerp(boneTransform.rotation, newRotation, smoothFactor * Time.deltaTime);
            }
            else
            {
                boneTransform.rotation = newRotation;
            }
        }
    }
コード例 #7
0
    public bool GestureCancelled(uint userId, int userIndex, KinectGestures.Gestures gesture,
                                 KinectWrapper.NuiSkeletonPositionIndex joint)
    {
        if (progressDisplayed)
        {
            // clear the progress info
            if (GestureInfo != null)
            {
                GestureInfo.GetComponent <TextMeshProUGUI>().text = String.Empty;
            }
            if (MouseInfo != null)
            {
                MouseInfo.GetComponent <TextMeshProUGUI>().text = String.Empty;
            }

            progressDisplayed = false;
        }

        return(true);
    }
コード例 #8
0
    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;
 *              else*/if (gesture == KinectGestures.Gestures.Wheel)
        {
            wheel = true;
        }
        return(true);
    }
コード例 #9
0
    /*ここはめっちゃ大事そう*/

    /*ボーンを動かしてるけど、どこで参照しているのやら
     * boneTransformがbones[index]の参照になっているんかな? あとで調べる*/
    /*その場合ここでunityちゃんのボーンの角度(位置も?)変えてる*/
    // Apply the rotations tracked by kinect to the joints.
    protected void TransformBone(uint userId, KinectWrapper.NuiSkeletonPositionIndex joint, int boneIndex, bool flip)
    {
        Transform boneTransform = bones[boneIndex];         //unityちゃんのボーンの位置とか入れる

        if (boneTransform == null || kinectManager == null) //ボーンなかったりkinectついてなかったらパス
        {
            return;
        }

        int iJoint = (int)joint;            //関節数をいれる  変換できんかったら−なるんかな?

        if (iJoint < 0)
        {
            return;
        }


        /*ここからメイン*/
        //ここでユーザーのある関節の角度ゲットしてる?
        Quaternion jointRotation = kinectManager.GetJointOrientation(userId, iJoint, flip);

        //取得できなかったらreturn
        if (jointRotation == Quaternion.identity)
        {
            return;
        }
        //ここでユーザーのさっきの情報使ってユーザーの回転角度ゲットしてる
        // Smoothly transition to the new rotation
        Quaternion newRotation = Kinect2AvatarRot(jointRotation, boneIndex);

        //前のボーンから今のボーンに移るまでの補完方法 smoothFactorが0以外なら計算時間かかるけどスムーズに動く
        if (smoothFactor != 0f)
        {
            boneTransform.rotation = Quaternion.Slerp(boneTransform.rotation, newRotation, smoothFactor * Time.deltaTime);
        }
        //ないなら強引に新しい位置にかえる
        else
        {
            boneTransform.rotation = newRotation;
        }
    }
コード例 #10
0
    // Update the avatar each frame.
    public void UpdateAvatar(uint UserID)
    {
        if (!transform.gameObject.activeInHierarchy)
        {
            return;
        }

        // Get the KinectManager instance
        if (kinectManager == null)
        {
            kinectManager = KinectManager.Instance;
        }

        // move the avatar to its Kinect position
        MoveAvatar(UserID);

        for (var boneIndex = 0; boneIndex < bones.Length; boneIndex++)
        {
            if (!bones[boneIndex])
            {
                continue;
            }

            if (boneIndex2JointMap.ContainsKey(boneIndex))
            {
                KinectWrapper.NuiSkeletonPositionIndex joint = !mirroredMovement ? boneIndex2JointMap[boneIndex] : boneIndex2MirrorJointMap[boneIndex];
                TransformBone(UserID, joint, boneIndex, !mirroredMovement);
            }
            else if (specIndex2JointMap.ContainsKey(boneIndex))
            {
                // special bones (clavicles)
                List <KinectWrapper.NuiSkeletonPositionIndex> alJoints = !mirroredMovement ? specIndex2JointMap[boneIndex] : specIndex2MirrorJointMap[boneIndex];

                if (alJoints.Count >= 2)
                {
                    //Vector3 baseDir = alJoints[0].ToString().EndsWith("Left") ? Vector3.left : Vector3.right;
                    //TransformSpecialBone(UserID, alJoints[0], alJoints[1], boneIndex, baseDir, !mirroredMovement);
                }
            }
        }
    }
コード例 #11
0
    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;
        }
        else if (gesture == KinectGestures.Gestures.SwipeRight)
        {
            swipeRight = true;
        }

        return(true);
    }
コード例 #12
0
    // Apply the rotations tracked by kinect to the joints.
    protected void TransformBone(uint userId, KinectWrapper.NuiSkeletonPositionIndex joint, int boneIndex, bool flip)
    {
        if (Hooked)
        {
            return;
        }
        Transform boneTransform = bones[boneIndex];

        if (boneTransform == null || kinectManager == null)
        {
            return;
        }

        int iJoint = (int)joint;

        if (iJoint < 0)
        {
            return;
        }

        // Get Kinect joint orientation
        Quaternion jointRotation = kinectManager.GetJointOrientation(userId, iJoint, flip);

        if (jointRotation == Quaternion.identity)
        {
            return;
        }

        // Smoothly transition to the new rotation
        Quaternion newRotation = Kinect2AvatarRot(jointRotation, boneIndex);

        if (smoothFactor != 0f)
        {
            boneTransform.rotation = Quaternion.Slerp(boneTransform.rotation, newRotation, smoothFactor * Time.deltaTime);
        }
        else
        {
            boneTransform.rotation = newRotation;
        }
    }
コード例 #13
0
ファイル: ThrowListener.cs プロジェクト: adtunm/rzut-pilka
    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.ThrowRight)
        {
            ThrowRight = true;
        }


        if (gesture == KinectGestures.Gestures.RaiseLeftHand)
        {
            riseLeftHand = true;
        }
        return(true);
    }
コード例 #14
0
    public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
                                 KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
    {
        string sGestureText = gesture + " detected";

        if (gesture == KinectGestures.Gestures.Click)
        {
            Debug.Log("Click");
        }
        if (gesture == KinectGestures.Gestures.RaiseLeftHand)
        {
            Debug.Log("hand raised");
        }
        if (GestureInfo != null)
        {
            GestureInfo.GetComponent <GUIText>().text = sGestureText;
        }

        progressDisplayed = false;

        return(true);
    }
コード例 #15
0
ファイル: JoeListener.cs プロジェクト: Maceva/Hasdec_PAK
    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.Joe) {
                    Joe = true;
                    contador++;
                    Debug.Log(contador);
        }
                            
        if (contador == 3)
        {
            SceneManager.LoadScene("Joe");
        }

        return true;
	}
コード例 #16
0
    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);

            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);

            progressDisplayed = true;
        }
        else if (gesture == KinectGestures.Gestures.Wheel && progress > 0.5f)
        {
            string sGestureText = string.Format("{0} detected, angle={1:F1} deg", gesture, screenPos.z);

            progressDisplayed = true;
        }
    }
コード例 #17
0
    // Aplicar la rotacion rastreada por el kinect a los joints.
    protected void TransformBone(uint userId, KinectWrapper.NuiSkeletonPositionIndex joint, int boneIndex, bool flip)
    {
        Transform boneTransform = bones[boneIndex];

        if (boneTransform == null || kinectManager == null)
        {
            return;
        }

        int iJoint = (int)joint;

        if (iJoint < 0)
        {
            return;
        }

        // Obtiene la orientacion de los Joints de kinect.
        Quaternion jointRotation = kinectManager.GetJointOrientation(userId, iJoint, flip);

        if (jointRotation == Quaternion.identity)
        {
            return;
        }

        // Transforma de manera suave (smooth) a la nueva rotación.
        Quaternion newRotation = Kinect2AvatarRot(jointRotation, boneIndex);

        //Camera.main.transform.rotation = jointRotation;
        if (smoothFactor != 0f)
        {
            boneTransform.rotation = Quaternion.Slerp(boneTransform.rotation, newRotation, smoothFactor * Time.deltaTime);
        }
        else
        {
            boneTransform.rotation = newRotation;
        }
    }
コード例 #18
0
    public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture,
                                 KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
    {
        string sGestureText = gesture + " detected";

        if (gesture == KinectGestures.Gestures.RaiseRightHand)         //check if Escape key/Back key is pressed
        {
            Application.LoadLevel(1);
        }

        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);
    }
コード例 #19
0
 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);
 }
コード例 #20
0
 public void GestureInProgress(uint userId, int userIndex, KinectGestures.Gestures gesture,
                               float progress, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
 {
     // don't do anything here
 }
コード例 #21
0
    public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
    {
        switch (gesture)
        {
        case KinectGestures.Gestures.SwipeRight:
            dresses[activeIndex].SetActive(false);
            activeIndex = (activeIndex + 1) % dresses.Count;
            dresses[activeIndex].SetActive(true);
            break;

        case KinectGestures.Gestures.SwipeLeft:
            dresses[activeIndex].SetActive(false);
            activeIndex = (activeIndex - 1) % dresses.Count;
            dresses[activeIndex].SetActive(true);
            break;
        }
        return(true);
    }
コード例 #22
0
    public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
    {
        string sGestureText = gesture + " detected";

        if (gesture == KinectGestures.Gestures.Jump)
        {
            DefenderManager.Jump(userId, players.Count);
        }
        GestureInfo.text = sGestureText;
        return(true);
    }
コード例 #23
0
 public void GestureInProgress(uint userId, int userIndex, KinectGestures.Gestures gesture, float progress, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
 {
     //throw new System.NotImplementedException();
 }
コード例 #24
0
ファイル: ThrowListener.cs プロジェクト: adtunm/rzut-pilka
 public void GestureInProgress(uint userId, int userIndex, KinectGestures.Gestures gesture,
                               float progress, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
 {
     string sGestureText = gesture + " in progress";
 }
コード例 #25
0
    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;
        }
    }
コード例 #26
0
 public virtual void GestureInProgress(uint userId, int userIndex, KinectGestures.Gestures gesture,
                                       float progress, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
 {
 }
コード例 #27
0
    // Update the avatar each frame.
    public void UpdateAvatar(uint UserID)
    {
        PlayerDetected = true;
        if (!transform.gameObject.activeInHierarchy)
        {
            return;
        }

        // Get the KinectManager instance
        if (kinectManager == null)
        {
            kinectManager = KinectManager.Instance;
        }
        // for rendering the head
        //****************************************
        // TODO: make it so it is mirrored when avatar controller mirror is on, off when off.
        if (rawImage)
        {
            rawImage.texture = kinectManager.GetUsersClrTex();
            int HeadIndex = (int)TrackedHead;


            if (kinectManager.IsJointTracked(UserID, HeadIndex))
            {
                Vector3 posJoint = kinectManager.GetRawSkeletonJointPos(UserID, HeadIndex);

                if (posJoint != Vector3.zero)
                {
                    // 3d position to depth
                    Vector2 posDepth = kinectManager.GetDepthMapPosForJointPos(posJoint);

                    // depth pos to color pos
                    Vector2 posColor = kinectManager.GetColorMapPosForDepthPos(posDepth);

                    float UVrecPosX = (float)posColor.x / KinectWrapper.Constants.ColorImageWidth;
                    float UVrecPosY = (float)posColor.y / KinectWrapper.Constants.ColorImageHeight;
                    UVrecPosX -= HeadImageWidth / 2.5f;
                    UVrecPosY -= HeadImageHeight / 2f;

                    //						Vector3 localPos = new Vector3(scaleX * 10f - 5f, 0f, scaleY * 10f - 5f); // 5f is 1/2 of 10f - size of the plane
                    //						Vector3 vPosOverlay = backgroundImage.transform.TransformPoint(localPos);
                    //Vector3 vPosOverlay = BottomLeft + ((vRight * scaleX) + (vUp * scaleY));

                    rawImage.uvRect = new Rect(Mathf.Lerp(rawImage.uvRect.x, UVrecPosX, smoothFactor * Time.deltaTime), Mathf.Lerp(rawImage.uvRect.y, UVrecPosY, smoothFactor * Time.deltaTime), HeadImageHeight, HeadImageWidth);
                    //	Vector3 vPosOverlay = Camera.main.ViewportToWorldPoint(new Vector3(scaleX, scaleY, distanceToCamera));
                    //	OverlayObject.transform.position = Vector3.Lerp(OverlayObject.transform.position, vPosOverlay, smoothFactor * Time.deltaTime);
                }
            }
        }
        //****************************
        // move the avatar to its Kinect position
        MoveAvatar(UserID);

        for (var boneIndex = 0; boneIndex < bones.Length; boneIndex++)
        {
            if (!bones[boneIndex])
            {
                continue;
            }

            if (boneIndex2JointMap.ContainsKey(boneIndex))
            {
                KinectWrapper.NuiSkeletonPositionIndex joint = !mirroredMovement ? boneIndex2JointMap[boneIndex] : boneIndex2MirrorJointMap[boneIndex];
                TransformBone(UserID, joint, boneIndex, !mirroredMovement);
            }
            else if (specIndex2JointMap.ContainsKey(boneIndex))
            {
                // special bones (clavicles)
                List <KinectWrapper.NuiSkeletonPositionIndex> alJoints = !mirroredMovement ? specIndex2JointMap[boneIndex] : specIndex2MirrorJointMap[boneIndex];

                if (alJoints.Count >= 2)
                {
                    //Vector3 baseDir = alJoints[0].ToString().EndsWith("Left") ? Vector3.left : Vector3.right;
                    //TransformSpecialBone(UserID, alJoints[0], alJoints[1], boneIndex, baseDir, !mirroredMovement);
                }
            }
        }
    }
コード例 #28
0
    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);
    }
コード例 #29
0
 public bool GestureCompleted(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint, Vector3 screenPos)
 {
     return(true);
 }
コード例 #30
0
 public bool GestureCancelled(uint userId, int userIndex, KinectGestures.Gestures gesture, KinectWrapper.NuiSkeletonPositionIndex joint)
 {
     return(true);
 }