add openxr specific session running and available conditions

Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
Schmarni
2024-10-18 23:43:39 +02:00
parent aea1cc66cd
commit 616bfff672
9 changed files with 46 additions and 19 deletions

View File

@@ -1,14 +1,12 @@
use bevy::prelude::*;
use bevy_mod_xr::hands::{HandBone, HandBoneRadius};
use bevy_mod_xr::hands::{LeftHand, RightHand, XrHandBoneEntities, HAND_JOINT_COUNT};
use bevy_mod_xr::session::{XrPreDestroySession, XrSessionCreated, XrTrackingRoot};
use bevy_mod_xr::spaces::{XrPrimaryReferenceSpace, XrReferenceSpace, XrVelocity};
use bevy_mod_xr::{
hands::{HandBone, HandBoneRadius},
session::session_running,
};
use openxr::{SpaceLocationFlags, SpaceVelocityFlags};
use crate::helper_traits::ToVec3;
use crate::openxr_session_running;
use crate::resources::OxrFrameState;
use crate::resources::Pipelined;
use crate::session::OxrSession;
@@ -27,7 +25,7 @@ impl Default for HandTrackingPlugin {
impl Plugin for HandTrackingPlugin {
fn build(&self, app: &mut App) {
app.add_systems(PreUpdate, locate_hands.run_if(session_running));
app.add_systems(PreUpdate, locate_hands.run_if(openxr_session_running));
if self.default_hands {
app.add_systems(XrPreDestroySession, clean_up_default_hands)
.add_systems(XrSessionCreated, spawn_default_hands);

View File

@@ -1,12 +1,12 @@
use std::{mem, ptr};
use bevy::prelude::*;
use bevy_mod_xr::session::session_available;
use openxr::sys;
use crate::{
next_chain::{OxrNextChainStructBase, OxrNextChainStructProvider},
openxr::exts::OxrEnabledExtensions,
openxr_session_available,
session::{OxrSessionCreateNextChain, OxrSessionCreateNextProvider},
};
@@ -16,7 +16,10 @@ impl Plugin for OxrOverlayPlugin {
fn build(&self, app: &mut bevy::prelude::App) {
app.add_event::<OxrOverlaySessionEvent>();
app.init_resource::<OxrOverlaySettings>();
app.add_systems(First, add_overlay_info_to_chain.run_if(session_available));
app.add_systems(
First,
add_overlay_info_to_chain.run_if(openxr_session_available),
);
}
}