Skip to content

Commit

Permalink
fix(server_openvr): 🐛 Fix crash when disabling separate hand trackers (
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerp authored Aug 13, 2024
1 parent cfd94ba commit af530b8
Showing 1 changed file with 34 additions and 27 deletions.
61 changes: 34 additions & 27 deletions alvr/server_openvr/cpp/alvr_server/alvr_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,33 +411,40 @@ void SetTracking(
if (deviceMotions[i].deviceID == HEAD_ID && g_driver_provider.hmd) {
g_driver_provider.hmd->OnPoseUpdated(targetTimestampNs, deviceMotions[i]);
} else {
if (g_driver_provider.left_controller && deviceMotions[i].deviceID == HAND_LEFT_ID) {
g_driver_provider.left_controller->onPoseUpdate(
controllerPoseTimeOffsetS,
deviceMotions[i],
leftHandSkeleton,
controllersTracked && !useLeftHandTracker
);
g_driver_provider.left_hand_tracker->onPoseUpdate(
controllerPoseTimeOffsetS,
deviceMotions[i],
leftHandSkeleton,
controllersTracked && useLeftHandTracker
);
} else if (g_driver_provider.right_controller
&& deviceMotions[i].deviceID == HAND_RIGHT_ID) {
g_driver_provider.right_controller->onPoseUpdate(
controllerPoseTimeOffsetS,
deviceMotions[i],
rightHandSkeleton,
controllersTracked && !useRightHandTracker
);
g_driver_provider.right_hand_tracker->onPoseUpdate(
controllerPoseTimeOffsetS,
deviceMotions[i],
rightHandSkeleton,
controllersTracked && useRightHandTracker
);
if (deviceMotions[i].deviceID == HAND_LEFT_ID) {
if (g_driver_provider.left_controller) {
g_driver_provider.left_controller->onPoseUpdate(
controllerPoseTimeOffsetS,
deviceMotions[i],
leftHandSkeleton,
controllersTracked && !useLeftHandTracker
);
}
if (g_driver_provider.left_hand_tracker) {
g_driver_provider.left_hand_tracker->onPoseUpdate(
controllerPoseTimeOffsetS,
deviceMotions[i],
leftHandSkeleton,
controllersTracked && useLeftHandTracker
);
}
} else if (deviceMotions[i].deviceID == HAND_RIGHT_ID) {
if (g_driver_provider.right_controller) {
g_driver_provider.right_controller->onPoseUpdate(
controllerPoseTimeOffsetS,
deviceMotions[i],
rightHandSkeleton,
controllersTracked && !useRightHandTracker
);
}
if (g_driver_provider.right_hand_tracker) {
g_driver_provider.right_hand_tracker->onPoseUpdate(
controllerPoseTimeOffsetS,
deviceMotions[i],
rightHandSkeleton,
controllersTracked && useRightHandTracker
);
}
}
}
}
Expand Down

0 comments on commit af530b8

Please sign in to comment.