コード例 #1
0
ファイル: BodyTemplate.cs プロジェクト: enanthav/581-a3
    //wait for KinectManager to completely update first
    void LateUpdate()
    {
        //TODO Your code here
//        if (Input.GetKeyDown(KeyCode.R))
//        {
//            showPaused();
//        }
        if (bodies.Count > 0)
        {
            showCalvin();
            //some bodies, send orientation update
            GameObject thumbRight   = bodies[0].GetJoint(Windows.Kinect.JointType.ThumbRight);
            GameObject handRight    = bodies[0].GetJoint(Windows.Kinect.JointType.HandRight);
            GameObject handTipRight = bodies[0].GetJoint(Windows.Kinect.JointType.HandTipRight);

            float wristRotation = KinectCVUtilities.VerticalWristRotation(
                handTipRight.transform.localPosition,
                handRight.transform.localPosition,
                thumbRight.transform.localPosition
                );

            //update the rotation
            this.transform.rotation = Quaternion.Euler(0, wristRotation, 0);
        }
    }
コード例 #2
0
    //wait for KinectManager to completely update first
    void LateUpdate()
    {
        //If player is in room
        if (bodies.Count > 0)
        {
            //some bodies, send orientation update
            GameObject thumbRight   = bodies[0].GetJoint(Windows.Kinect.JointType.ThumbRight);
            GameObject handRight    = bodies[0].GetJoint(Windows.Kinect.JointType.HandRight);
            GameObject handTipRight = bodies[0].GetJoint(Windows.Kinect.JointType.HandTipRight);

            float wristRotation = KinectCVUtilities.VerticalWristRotation(
                handTipRight.transform.localPosition,
                handRight.transform.localPosition,
                thumbRight.transform.localPosition
                );

            //update the rotation
            this.transform.rotation = Quaternion.Euler(0, wristRotation, 0);
        }
    }
コード例 #3
0
ファイル: BodyNetworkTemplate.cs プロジェクト: murrrkle/helen
    //wait for KinectManager to completely update first
    void LateUpdate()
    {
        //TODO Your code here
        if (bodies.Count > 0)
        {
            //some bodies, send orientation update
            GameObject thumbRight   = bodies[0].GetJoint(Windows.Kinect.JointType.ThumbRight);
            GameObject handRight    = bodies[0].GetJoint(Windows.Kinect.JointType.HandRight);
            GameObject handTipRight = bodies[0].GetJoint(Windows.Kinect.JointType.HandTipRight);

            float wristRotation = KinectCVUtilities.VerticalWristRotation(
                handTipRight.transform.localPosition,
                handRight.transform.localPosition,
                thumbRight.transform.localPosition
                );

            //send the rotation
            Message wristRotationMessage = new Message("WristRotation");
            wristRotationMessage.AddField("angle", "" + wristRotation);
            wristRotationMessage.DeliverToSelf = true;
            networkItClient.SendMessage(wristRotationMessage);
        }
    }