Skip to content

Commit

Permalink
Fix skeleton issues (#1132)
Browse files Browse the repository at this point in the history
  • Loading branch information
ButterscotchV authored Aug 7, 2024
1 parent 8b97c0e commit 518fe8d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -1099,7 +1096,7 @@ class HumanSkeleton(
}
}
legTweaks.resetBuffer()
LogManager.info(String.format("[HumanSkeleton] Reset: yaw (%s)", resetSourceName))
LogManager.info("[HumanSkeleton] Reset: yaw ($resetSourceName)")
}

@VRServerThread
Expand All @@ -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
Expand All @@ -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() {
Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 518fe8d

Please sign in to comment.