Fix skeleton issues (#1132)

This commit is contained in:
Butterscotch!
2024-08-07 16:41:01 -04:00
committed by GitHub
parent 8b97c0eb27
commit 518fe8d2ef
4 changed files with 21 additions and 16 deletions

View File

@@ -151,7 +151,7 @@ class AutoBoneHandler(private val server: VRServer) {
} catch (e: Exception) {
announceProcessStatus(
AutoBoneProcessType.RECORD,
String.format("Recording failed: %s", e.message),
"Recording failed: ${e.message}",
completed = true,
success = false,
)
@@ -212,7 +212,7 @@ class AutoBoneHandler(private val server: VRServer) {
} catch (e: Exception) {
announceProcessStatus(
AutoBoneProcessType.SAVE,
String.format("Failed to save recording: %s", e.message),
"Failed to save recording: ${e.message}",
completed = true,
success = false,
)
@@ -329,7 +329,7 @@ class AutoBoneHandler(private val server: VRServer) {
} catch (e: Exception) {
announceProcessStatus(
AutoBoneProcessType.PROCESS,
String.format("Processing failed: %s", e.message),
"Processing failed: ${e.message}",
completed = true,
success = false,
)

View File

@@ -494,6 +494,14 @@ class HumanPoseManager(val server: VRServer?) {
skeleton.updateNodeOffset(boneType, offset)
}
/**
* Updates all the node offsets in the skeleton
*/
fun updateNodeOffsetsInSkeleton() {
if (!isSkeletonPresent) return
skeletonConfigManager.updateNodeOffsetsInSkeleton()
}
/**
* Update the given toggle to the new given value in the skeleton
*

View File

@@ -298,11 +298,8 @@ class HumanSkeleton(
// Rebuilds the arm skeleton nodes attachments
assembleSkeletonArms(true)
// Refresh headShift
humanPoseManager.computeNodeOffset(BoneType.HEAD)
// Refresh node offsets for arms
computeDependentArmOffsets()
// Refresh all skeleton node offsets based on new trackers
humanPoseManager.updateNodeOffsetsInSkeleton()
// Update tap detection's trackers
tapDetectionManager.updateConfig(trackers)
@@ -889,7 +886,7 @@ class HumanSkeleton(
var transOffset = offset
// If no head position, headShift and neckLength = 0
if (boneType == BoneType.HEAD || boneType == BoneType.NECK && (headTracker == null || !(headTracker!!.hasPosition && headTracker!!.hasRotation))) {
if ((boneType == BoneType.HEAD || boneType == BoneType.NECK) && (headTracker == null || !(headTracker!!.hasPosition && headTracker!!.hasRotation))) {
transOffset = NULL
}
// If trackingArmFromController, reverse
@@ -1078,7 +1075,7 @@ class HumanSkeleton(
}
legTweaks.resetBuffer()
localizer.reset()
LogManager.info(String.format("[HumanSkeleton] Reset: full (%s)", resetSourceName))
LogManager.info("[HumanSkeleton] Reset: full ($resetSourceName)")
}
@VRServerThread
@@ -1099,7 +1096,7 @@ class HumanSkeleton(
}
}
legTweaks.resetBuffer()
LogManager.info(String.format("[HumanSkeleton] Reset: yaw (%s)", resetSourceName))
LogManager.info("[HumanSkeleton] Reset: yaw ($resetSourceName)")
}
@VRServerThread
@@ -1121,7 +1118,7 @@ class HumanSkeleton(
}
legTweaks.resetBuffer()
localizer.reset()
LogManager.info(String.format("[HumanSkeleton] Reset: mounting (%s)", resetSourceName))
LogManager.info("[HumanSkeleton] Reset: mounting ($resetSourceName)")
}
@VRServerThread
@@ -1137,7 +1134,7 @@ class HumanSkeleton(
}
}
legTweaks.resetBuffer()
LogManager.info(String.format("[HumanSkeleton] Clear: mounting (%s)", resetSourceName))
LogManager.info("[HumanSkeleton] Clear: mounting ($resetSourceName)")
}
fun updateTapDetectionConfig() {
@@ -1223,7 +1220,7 @@ class HumanSkeleton(
legTweaks.resetBuffer()
}
this.pauseTracking = pauseTracking
LogManager.info(String.format("[HumanSkeleton] ${if (pauseTracking) "Pause" else "Unpause"} tracking (%s)", sourceName))
LogManager.info("[HumanSkeleton] ${if (pauseTracking) "Pause" else "Unpause"} tracking ($sourceName)")
// Report the new state of tracking pause
humanPoseManager.trackingPauseHandler.sendTrackingPauseState(pauseTracking)
}

View File

@@ -266,8 +266,8 @@ class TrackerResetsHandler(val tracker: Tracker) {
makeIdentityAdjustmentQuatsFull()
// (don't adjust yaw if head and computed)
if (tracker.trackerPosition != TrackerPosition.HEAD || tracker.isComputed) {
// Don't adjust yaw if head and computed
if (tracker.trackerPosition != TrackerPosition.HEAD || !tracker.isComputed) {
yawFix = fixYaw(mountingAdjustedRotation, reference)
yawResetSmoothTimeRemain = 0.0f
}