updates to check for controller entities in emulated hand tracking

This commit is contained in:
Jay Christy
2023-11-21 13:34:23 -05:00
parent 44b9e02130
commit 47a5aa0daa

View File

@@ -144,6 +144,9 @@ pub(crate) fn update_hand_skeleton_from_emulated(
), ),
>, >,
) { ) {
//get the transforms outside the loop
let left = left_controller_transform.get_single();
let right = right_controller_transform.get_single();
let mut data: [[Transform; 26]; 2] = [[Transform::default(); 26]; 2]; let mut data: [[Transform; 26]; 2] = [[Transform::default(); 26]; 2];
for (subaction_path, hand) in [ for (subaction_path, hand) in [
( (
@@ -189,21 +192,36 @@ pub(crate) fn update_hand_skeleton_from_emulated(
.state(&session, subaction_path) .state(&session, subaction_path)
.unwrap() .unwrap()
.current_state; .current_state;
data[match hand { match hand {
Hand::Left => 0, Hand::Left => match left {
Hand::Right => 1, Ok(hand_transform) => {
}] = update_hand_bones_emulated( data[0] = update_hand_bones_emulated(
match hand { hand_transform,
Hand::Left => left_controller_transform.single(), hand,
Hand::Right => right_controller_transform.single(), thumb_curl,
index_curl,
middle_curl,
ring_curl,
little_curl,
);
}
Err(_) => debug!("no left controller transform for hand bone emulation"),
}, },
hand, Hand::Right => match right {
thumb_curl, Ok(hand_transform) => {
index_curl, data[1] = update_hand_bones_emulated(
middle_curl, hand_transform,
ring_curl, hand,
little_curl, thumb_curl,
); index_curl,
middle_curl,
ring_curl,
little_curl,
);
}
Err(_) => debug!("no right controller transform for hand bone emulation"),
},
}
} }
let trt = tracking_root_transform.single(); let trt = tracking_root_transform.single();
for (mut t, bone, hand, status, mut radius) in bones.iter_mut() { for (mut t, bone, hand, status, mut radius) in bones.iter_mut() {