public void Update() { //update the skeleton, depth-, and rgb image NiteWrapper.Update(true); if (!calibratedUser) { //gui.UpdateUserMap(); } gui.UpdateRgbImage(); List <Rig> destroyedRigs = new List <Rig>(); //update the rigs controlled by this controller foreach (Rig rig in registeredRigs) { Vector3 position; Quaternion rotation; // Check if rig still exists: if (rig.riggedObject != null) { // Update body location if (GetJointPosition(NiteWrapper.SkeletonJoint.TORSO_CENTER, out position)) { rig.jointMapping[NiteWrapper.SkeletonJoint.TORSO_CENTER].position = position; } // Update the rotation for each joint foreach (KeyValuePair <NiteWrapper.SkeletonJoint, Transform> pair in rig.jointMapping) { if (GetJointOrientation(pair.Key, out rotation)) { pair.Value.rotation = rotation * rig.referenceOrientation[pair.Key]; } } // Update joint positions foreach (KeyValuePair <NiteWrapper.SkeletonJoint, Transform> pair in rig.jointMapping) { if (GetJointPosition(pair.Key, out position)) { pair.Value.position = position; } } } else { destroyedRigs.Add(rig); } } foreach (Rig rig in destroyedRigs) { registeredRigs.Remove(rig); } }
void Update() { // Next NITE frame NiteWrapper.Update(true); // update the visual user map UpdateUserMap(); // update avatars foreach (KeyValuePair <uint, SoldierAvatar> pair in calibratedUsers) { pair.Value.UpdateAvatar(pair.Key); } }