Skip to content

Commit ec1a94f

Browse files
committed
fix(server_openvr): 🐛 Fix tracked toggle for controllers
1 parent 7ece87b commit ec1a94f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

alvr/server_openvr/src/lib.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,17 @@ extern "C" fn driver_ready_idle(set_default_chap: bool) {
129129
.unwrap_or_else(FfiDeviceMotion::default);
130130
let ffi_left_controller_motion = context
131131
.get_device_motion(*HAND_LEFT_ID, sample_timestamp)
132-
.map(|m| tracking::to_ffi_motion(*HAND_LEFT_ID, m));
133-
let ffi_right_controller_motion = context
132+
.map(|m| tracking::to_ffi_motion(*HAND_LEFT_ID, m))
133+
.filter(|_| tracked);
134+
let ffi_right_controller_motion = context
134135
.get_device_motion(*HAND_RIGHT_ID, sample_timestamp)
135-
.map(|m| tracking::to_ffi_motion(*HAND_RIGHT_ID, m));
136+
.map(|m| tracking::to_ffi_motion(*HAND_RIGHT_ID, m))
137+
.filter(|_| tracked);
136138

137139
let (
138-
use_separate_hand_trackers,
139140
ffi_left_hand_skeleton,
140141
ffi_right_hand_skeleton,
142+
use_separate_hand_trackers,
141143
predict_hand_skeleton,
142144
) = if let Some(ControllersConfig {
143145
hand_skeleton: Switch::Enabled(hand_skeleton_config),
@@ -164,13 +166,13 @@ extern "C" fn driver_ready_idle(set_default_chap: bool) {
164166
});
165167

166168
(
167-
hand_skeleton_config.steamvr_input_2_0,
168169
tracked.then_some(left_hand_skeleton).flatten(),
169170
tracked.then_some(right_hand_skeleton).flatten(),
171+
hand_skeleton_config.steamvr_input_2_0,
170172
hand_skeleton_config.predict,
171173
)
172174
} else {
173-
(false, None, None, false)
175+
(None, None, false, false)
174176
};
175177

176178
let ffi_left_hand_data = FfiHandData {

0 commit comments

Comments
 (0)