Skip to content

Commit

Permalink
fix(server_openvr): 🐛 Set body trackers as disabled if not tracking (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerp authored Sep 19, 2024
1 parent 09b78e0 commit 23a92e9
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions alvr/server_openvr/src/tracking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,26 @@ pub fn to_ffi_body_trackers(
});

let mut trackers = vec![];

for (id, motion) in device_motions {
if BODY_TRACKER_ID_MAP.contains_key(id) {
for i in 0..8 {
if let Some((id, motion)) = device_motions.iter().find(|(id, _)| {
BODY_TRACKER_ID_MAP
.get(id)
.map(|id| *id == i)
.unwrap_or(false)
}) {
trackers.push(FfiBodyTracker {
trackerID: *BODY_TRACKER_ID_MAP.get(id).unwrap(),
orientation: to_ffi_quat(motion.pose.orientation),
position: motion.pose.position.to_array(),
tracking: tracking.into(),
});
} else {
trackers.push(FfiBodyTracker {
trackerID: i,
orientation: to_ffi_quat(Quat::IDENTITY),
position: [0_f32; 3],
tracking: 0,
});
}
}

Expand Down

0 comments on commit 23a92e9

Please sign in to comment.