made proto_locomotion used a config resource
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use bevy::prelude::Component;
|
||||
use bevy::prelude::{info, Added, BuildChildren, Commands, Component, Entity, Query, With};
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct OpenXRTrackingRoot;
|
||||
@@ -16,3 +16,21 @@ pub struct OpenXRLeftController;
|
||||
pub struct OpenXRRightController;
|
||||
#[derive(Component)]
|
||||
pub struct OpenXRController;
|
||||
|
||||
pub fn adopt_open_xr_trackers(
|
||||
query: Query<(Entity), Added<OpenXRTracker>>,
|
||||
mut commands: Commands,
|
||||
tracking_root_query: Query<(Entity, With<OpenXRTrackingRoot>)>,
|
||||
) {
|
||||
let root = tracking_root_query.get_single();
|
||||
match root {
|
||||
Ok(thing) => {
|
||||
// info!("root is");
|
||||
for tracker in query.iter() {
|
||||
info!("we got a new tracker");
|
||||
commands.entity(thing.0).add_child(tracker);
|
||||
}
|
||||
}
|
||||
Err(_) => info!("root isnt spawned yet?"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user