Skip to content

Commit

Permalink
Fix tracker reset logic (#1150)
Browse files Browse the repository at this point in the history
  • Loading branch information
ButterscotchV authored Sep 13, 2024
1 parent 2c14616 commit 1c867ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ class Tracker @JvmOverloads constructor(
_rotation
}

if (needsReset || (isComputed && !isInternal)) {
// Reset if needed and is not computed and internal
if (needsReset && !(isComputed && isInternal)) {
// Adjust to reset, mounting and drift compensation
rot = resetsHandler.getReferenceAdjustedDriftRotationFrom(rot)
}
Expand Down Expand Up @@ -354,7 +355,8 @@ class Tracker @JvmOverloads constructor(
_rotation
}

if (needsReset || (isComputed && trackerPosition == TrackerPosition.HEAD)) {
// Reset if needed or is a computed tracker besides head
if (needsReset && !(isComputed && trackerPosition != TrackerPosition.HEAD)) {
// Adjust to reset and mounting
rot = resetsHandler.getIdentityAdjustedDriftRotationFrom(rot)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,16 @@ abstract class SteamVRBridge(

// Display name, needsReset and isHmd
val displayName: String
val (needsReset, isHmd) = if (trackerAdded.trackerId == 0) {
val isHmd = if (trackerAdded.trackerId == 0) {
displayName = if (trackerAdded.trackerName == "HMD") {
"SteamVR Driver HMD"
} else {
"Feeder App HMD"
}
false to true
true
} else {
displayName = trackerAdded.trackerName
true to false
false
}

// trackerPosition
Expand All @@ -187,7 +187,7 @@ abstract class SteamVRBridge(
hasRotation = true,
userEditable = true,
isComputed = true,
needsReset = needsReset,
needsReset = true,
isHmd = isHmd,
)

Expand Down

0 comments on commit 1c867ef

Please sign in to comment.