public void UpdateSkeleton(int userId, OpenNISkeleton skeleton) { // make sure we have skeleton data for this user if (!skeletonCapbility.IsTracking(userId)) { return; } // Use torso as root SkeletonJointTransformation skelTrans = new SkeletonJointTransformation(); skelTrans = skeletonCapbility.GetSkeletonJoint(userId, SkeletonJoint.Torso); if (skeleton.absolute) { Point3D pos = skelTrans.Position.Position; skeleton.UpdateRoot(new Vector3(pos.X, pos.Y, pos.Z)); } else { Point3D pos = skelTrans.Position.Position; Vector3 v3dpos = new Vector3(pos.X, pos.Y, -pos.Z); Vector3 calPos = userCalibrationPosition[userId]; skeleton.UpdateRoot(calPos - v3dpos); } // update each joint with data from OpenNI foreach (SkeletonJoint joint in Enum.GetValues(typeof(SkeletonJoint))) { if (skeletonCapbility.IsJointAvailable(joint)) { skelTrans = skeletonCapbility.GetSkeletonJoint(userId, joint); skeleton.UpdateJoint(joint, skelTrans); } } }
public void UpdateSkeleton(int userId, OpenNISkeleton skeleton) { // make sure we have skeleton data for this user if (!skeletonCapbility.IsTracking(userId)) { return; } // Use torso as root SkeletonJointTransformation skelTrans = new SkeletonJointTransformation(); skelTrans = skeletonCapbility.GetSkeletonJoint(userId, SkeletonJoint.Torso); if (skeleton.absolute) { Point3D pos = skelTrans.Position.Position; skeleton.UpdateRoot(new Vector3(pos.X,pos.Y,pos.Z)); } else { Point3D pos = skelTrans.Position.Position; Vector3 v3dpos = new Vector3(pos.X, pos.Y, -pos.Z); Vector3 calPos = userCalibrationPosition[userId]; skeleton.UpdateRoot(calPos - v3dpos); } // update each joint with data from OpenNI foreach (SkeletonJoint joint in Enum.GetValues(typeof(SkeletonJoint))) { if (skeletonCapbility.IsJointAvailable(joint)) { skelTrans = skeletonCapbility.GetSkeletonJoint(userId, joint); skeleton.UpdateJoint(joint, skelTrans); } } }
public void UpdateSkeleton(int userId, OpenNISkeleton skeleton) { // make sure we have skeleton data for this user if (!skeletonCapbility.IsTracking(userId)) { return; } // Use torso as root SkeletonJointTransformation skelTrans = new SkeletonJointTransformation(); skelTrans = skeletonCapbility.GetSkeletonJoint(userId, SkeletonJoint.Torso); skeleton.UpdateRoot(skelTrans.Position.Position); // update each joint with data from OpenNI foreach (SkeletonJoint joint in Enum.GetValues(typeof(SkeletonJoint))) { if (skeletonCapbility.IsJointAvailable(joint)) { skelTrans = skeletonCapbility.GetSkeletonJoint(userId, joint); skeleton.UpdateJoint(joint, skelTrans); } } }