added right hand aim poses

This commit is contained in:
Jay Christy
2023-10-01 23:48:58 -04:00
parent 6fc41ecbfc
commit 903dc2a5da

View File

@@ -74,8 +74,8 @@ pub fn update_open_xr_controllers(
let left_grip_space = controller.grip_space(Hand::Left); let left_grip_space = controller.grip_space(Hand::Left);
let left_aim_space = controller.aim_space(Hand::Left); let left_aim_space = controller.aim_space(Hand::Left);
let left_postion = left_grip_space.0.pose.position.to_vec3(); let left_postion = left_grip_space.0.pose.position.to_vec3();
let aim_pose = left_controller_query.get_single_mut().unwrap().1; let left_aim_pose = left_controller_query.get_single_mut().unwrap().1;
match aim_pose { match left_aim_pose {
Some(mut pose) => { Some(mut pose) => {
*pose = AimPose(Transform { *pose = AimPose(Transform {
translation: left_aim_space.0.pose.position.to_vec3(), translation: left_aim_space.0.pose.position.to_vec3(),
@@ -95,8 +95,21 @@ pub fn update_open_xr_controllers(
left_controller_query.get_single_mut().unwrap().0.rotation = left_controller_query.get_single_mut().unwrap().0.rotation =
left_grip_space.0.pose.orientation.to_quat(); left_grip_space.0.pose.orientation.to_quat();
//get right controller //get right controller
let right = controller.grip_space(Hand::Right); let right_grip_space = controller.grip_space(Hand::Right);
let right_postion = right.0.pose.position.to_vec3(); let right_aim_space = controller.aim_space(Hand::Right);
let right_postion = right_grip_space.0.pose.position.to_vec3();
let right_aim_pose = right_controller_query.get_single_mut().unwrap().1;
match right_aim_pose {
Some(mut pose) => {
*pose = AimPose(Transform {
translation: right_aim_space.0.pose.position.to_vec3(),
rotation: right_aim_space.0.pose.orientation.to_quat(),
scale: Vec3::splat(1.0),
});
}
None => (),
}
right_controller_query right_controller_query
.get_single_mut() .get_single_mut()
@@ -105,5 +118,5 @@ pub fn update_open_xr_controllers(
.translation = right_postion; .translation = right_postion;
right_controller_query.get_single_mut().unwrap().0.rotation = right_controller_query.get_single_mut().unwrap().0.rotation =
right.0.pose.orientation.to_quat(); right_grip_space.0.pose.orientation.to_quat();
} }