diff --git a/server/core/src/main/java/dev/slimevr/tracking/processor/HumanPoseManager.java b/server/core/src/main/java/dev/slimevr/tracking/processor/HumanPoseManager.java index 80d5f341f2..56801476e2 100644 --- a/server/core/src/main/java/dev/slimevr/tracking/processor/HumanPoseManager.java +++ b/server/core/src/main/java/dev/slimevr/tracking/processor/HumanPoseManager.java @@ -11,7 +11,6 @@ import dev.slimevr.tracking.trackers.Tracker; import dev.slimevr.tracking.trackers.TrackerPosition; import dev.slimevr.tracking.trackers.TrackerRole; -import dev.slimevr.tracking.trackers.TrackerStatus; import dev.slimevr.util.ann.VRServerThread; import io.eiren.util.ann.ThreadSafe; import io.eiren.util.collections.FastList; @@ -50,7 +49,14 @@ private HumanPoseManager() { */ public HumanPoseManager(VRServer server) { this(); + skeleton = new HumanSkeleton(this, server); this.server = server; + // This computes all node offsets, so the defaults don't need to be + // explicitly loaded into the skeleton (no need for + // `updateNodeOffsetsInSkeleton()`) + loadFromConfig(server.configManager); + for (Consumer sc : onSkeletonUpdated) + sc.accept(skeleton); } /** @@ -316,43 +322,7 @@ public void loadFromConfig(ConfigManager configManager) { @VRServerThread public void updateSkeletonModelFromServer() { - disconnectComputedHumanPoseTrackers(); - - // Make a new skeleton and store the old state - HumanSkeleton oldSkeleton = skeleton; - skeleton = new HumanSkeleton(this, server); - - // Transfer the state of the old skeleton to the new one - if (oldSkeleton != null) { - skeleton.setPauseTracking(oldSkeleton.getPauseTracking()); - - // If paused, copy the pose to the new skeleton so it doesn't reset - // to t-pose each time - if (oldSkeleton.getPauseTracking()) { - TransformNode[] oldNodes = oldSkeleton.getAllNodes(); - TransformNode[] newNodes = skeleton.getAllNodes(); - - for (int i = 0; i < newNodes.length; i++) { - newNodes[i] - .getLocalTransform() - .setRotation(oldNodes[i].getLocalTransform().getRotation()); - } - } - } - - // This recomputes all node offsets, so the defaults don't need to be - // explicitly loaded into the skeleton (no need for - // `updateNodeOffsetsInSkeleton()`) - loadFromConfig(server.configManager); - for (Consumer sc : onSkeletonUpdated) - sc.accept(skeleton); - } - - @VRServerThread - private void disconnectComputedHumanPoseTrackers() { - for (Tracker t : computedTrackers) { - t.setStatus(TrackerStatus.DISCONNECTED); - } + skeleton.setTrackersFromList(server.getAllTrackers()); } // #endregion diff --git a/server/core/src/main/java/dev/slimevr/tracking/processor/skeleton/HumanSkeleton.java b/server/core/src/main/java/dev/slimevr/tracking/processor/skeleton/HumanSkeleton.java index 8dd9b41ed8..610adc8629 100644 --- a/server/core/src/main/java/dev/slimevr/tracking/processor/skeleton/HumanSkeleton.java +++ b/server/core/src/main/java/dev/slimevr/tracking/processor/skeleton/HumanSkeleton.java @@ -385,7 +385,7 @@ protected void resetBones() { // #region Set trackers inputs - protected void setTrackersFromList(List trackers) { + public void setTrackersFromList(List trackers) { headTracker = TrackerUtils .getTrackerForSkeleton( trackers,