fixed some debug gizmos

This commit is contained in:
Jay Christy
2023-11-21 13:59:43 -05:00
parent c4c8308d34
commit b2f28a9753

View File

@@ -1,8 +1,8 @@
use bevy::log::{debug, info};
use bevy::prelude::{ use bevy::prelude::{
Color, Gizmos, GlobalTransform, Plugin, Quat, Query, Res, Transform, Update, Vec2, Vec3, With, Color, Gizmos, GlobalTransform, Plugin, Quat, Query, Res, Transform, Update, Vec2, Vec3, With,
Without, Without,
}; };
use bevy::log::info;
use crate::{ use crate::{
input::XrInput, input::XrInput,
@@ -103,11 +103,22 @@ pub fn draw_gizmos(
Err(_) => info!("too many tracking roots"), Err(_) => info!("too many tracking roots"),
} }
//draw the hands //draw the hands
let left_transform = left_controller_query.get_single().unwrap().0; //left
let right_transform = right_controller_query.get_single().unwrap().0; let left_transform = left_controller_query.get_single();
match left_transform {
draw_hand_gizmo(&mut gizmos, &controller, Hand::Right, right_transform); Ok(left_entity) => {
draw_hand_gizmo(&mut gizmos, &controller, Hand::Left, left_transform); draw_hand_gizmo(&mut gizmos, &controller, Hand::Left, left_entity.0);
}
Err(_) => debug!("no left controller entity for debug gizmos"),
}
//right
let right_transform = right_controller_query.get_single();
match right_transform {
Ok(right_entity) => {
draw_hand_gizmo(&mut gizmos, &controller, Hand::Right, right_entity.0);
}
Err(_) => debug!("no right controller entity for debug gizmos"),
}
} }
fn draw_hand_gizmo( fn draw_hand_gizmo(