void HandleSkeletonDataReceived (object sender, SkeletonEventArgs e)
	{
		try
		{
			joints = e.Skeleton.UserObject.CurrentUser.SketelonJoints;
			for (int i = 0; i < 15; i++) 
			{
				switch (i) 
				{
				case 0:rotations[i] = new Quaternion((float)joints.Head.OrientX,(float)joints.Head.OrientY,(float)joints.Head.OrientZ,(float)joints.Head.OrientW);
					break;
				case 1:rotations[i] = new Quaternion((float)joints.Neck.OrientX,(float)joints.Neck.OrientY,(float)joints.Neck.OrientZ,(float)joints.Neck.OrientW);
					break;
				case 2:rotations[i] = new Quaternion((float)joints.LeftShoulder.OrientX,(float)joints.LeftShoulder.OrientY,(float)joints.LeftShoulder.OrientZ,(float)joints.LeftShoulder.OrientW);
					break;
                case 3:rotations[i] = new Quaternion((float)joints.RightShoulder.OrientX,(float)joints.RightShoulder.OrientY,(float)joints.RightShoulder.OrientZ,(float)joints.RightShoulder.OrientW);
					break;
				case 4:rotations[i] = new Quaternion((float)joints.LeftElbow.OrientX,(float)joints.LeftElbow.OrientY,(float)joints.LeftElbow.OrientZ,(float)joints.LeftElbow.OrientW);
					break;
				case 5:rotations[i] = new Quaternion((float)joints.RightElbow.OrientX,(float)joints.RightElbow.OrientY,(float)joints.RightElbow.OrientZ,(float)joints.RightElbow.OrientW);
					break;
				case 6:rotations[i] = new Quaternion((float)joints.LeftHand.OrientX,(float)joints.LeftHand.OrientY,(float)joints.LeftHand.OrientZ,(float)joints.LeftHand.OrientW);
					break;
				case 7:rotations[i] = new Quaternion((float)joints.RightHand.OrientX,(float)joints.RightHand.OrientY,(float)joints.RightHand.OrientZ,(float)joints.RightHand.OrientW);
					break;
				case 8:rotations[i] = new Quaternion((float)joints.Torso.OrientX,(float)joints.Torso.OrientY,(float)joints.Torso.OrientZ,(float)joints.Torso.OrientW);
					break;
				case 9:rotations[i] = new Quaternion((float)joints.LeftHip.OrientX,(float)joints.LeftHip.OrientY,(float)joints.LeftHip.OrientZ,(float)joints.LeftHip.OrientW);
					break;
				case 10:rotations[i] = new Quaternion((float)joints.RightHip.OrientX,(float)joints.RightHip.OrientY,(float)joints.RightHip.OrientZ,(float)joints.RightHip.OrientW);
					break;
				case 11:rotations[i] = new Quaternion((float)joints.LeftKnee.OrientX,(float)joints.LeftKnee.OrientY,(float)joints.LeftKnee.OrientZ,(float)joints.LeftKnee.OrientW);
					break;
				case 12:rotations[i] = new Quaternion((float)joints.RightKnee.OrientX,(float)joints.RightKnee.OrientY,(float)joints.RightKnee.OrientZ,(float)joints.RightKnee.OrientW);
					break;
				case 13:rotations[i] = new Quaternion((float)joints.LeftFoot.OrientX,(float)joints.LeftFoot.OrientY,(float)joints.LeftFoot.OrientZ,(float)joints.LeftFoot.OrientW);
					break;
				case 14:rotations[i] = new Quaternion((float)joints.RightFoot.OrientX,(float)joints.RightFoot.OrientY,(float)joints.RightFoot.OrientZ,(float)joints.RightFoot.OrientW);
					break;
				default:
					break;
				}
			}
		}
		catch(Exception ex)
		{
			Debug.Log(ex.Message);
		}
	}
Beispiel #2
0
 public User()
 {
     SketelonJoints = new Joints();
 }