only render hand gizmos if they are actively tracked
Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use bevy::color::palettes::css;
|
||||
use bevy::{prelude::*, transform::TransformSystem};
|
||||
use bevy_mod_xr::hands::{HandBone, HandBoneRadius};
|
||||
use bevy_mod_xr::spaces::XrSpaceLocationFlags;
|
||||
pub struct HandGizmosPlugin;
|
||||
impl Plugin for HandGizmosPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
@@ -12,9 +13,17 @@ impl Plugin for HandGizmosPlugin {
|
||||
}
|
||||
fn draw_hand_gizmos(
|
||||
mut gizmos: Gizmos,
|
||||
query: Query<(&GlobalTransform, &HandBone, &HandBoneRadius)>,
|
||||
query: Query<(
|
||||
&GlobalTransform,
|
||||
&HandBone,
|
||||
&HandBoneRadius,
|
||||
&XrSpaceLocationFlags,
|
||||
)>,
|
||||
) {
|
||||
for (transform, bone, radius) in &query {
|
||||
for (transform, bone, radius, flags) in &query {
|
||||
if (!flags.position_tracked) || (!flags.rotation_tracked) {
|
||||
continue;
|
||||
}
|
||||
let pose = transform.compute_transform();
|
||||
let pose = Isometry3d {
|
||||
translation: pose.translation.into(),
|
||||
|
||||
Reference in New Issue
Block a user