change scheduling

Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
Schmarni
2024-05-19 04:48:49 +02:00
parent 72f2e7174e
commit fb9ec378c8
12 changed files with 292 additions and 127 deletions

View File

@@ -2,14 +2,15 @@ use bevy::prelude::*;
use bevy_xr::hands::{LeftHand, RightHand};
use bevy_xr::{
hands::{HandBone, HandBoneRadius},
session::{session_running, status_changed_to, XrStatus},
session::{session_running, XrSessionCreated, XrSessionEnding},
};
use openxr::SpaceLocationFlags;
use crate::{
init::OxrTrackingRoot,
reference_space::{OxrPrimaryReferenceSpace, OxrReferenceSpace},
resources::{OxrSession, OxrTime},
resources::OxrTime,
session::OxrSession,
};
pub struct HandTrackingPlugin {
@@ -27,14 +28,8 @@ impl Plugin for HandTrackingPlugin {
fn build(&self, app: &mut App) {
app.add_systems(PreUpdate, locate_hands.run_if(session_running));
if self.default_hands {
app.add_systems(
PreUpdate,
clean_up_default_hands.run_if(status_changed_to(XrStatus::Exiting)),
);
app.add_systems(
PostUpdate,
spawn_default_hands.run_if(status_changed_to(XrStatus::Ready)),
);
app.add_systems(XrSessionEnding, clean_up_default_hands);
app.add_systems(XrSessionCreated, spawn_default_hands);
}
}
}

View File

@@ -7,6 +7,7 @@ use openxr::PassthroughCapabilityFlagsFB;
use crate::layer_builder::PassthroughLayer;
use crate::resources::*;
use crate::session::OxrSession;
use crate::types::*;
pub struct OxrPassthroughPlugin;