core dumps on session end
This commit is contained in:
@@ -37,35 +37,35 @@ fn main() {
|
|||||||
.add_plugins(LogDiagnosticsPlugin::default())
|
.add_plugins(LogDiagnosticsPlugin::default())
|
||||||
.add_plugins(FrameTimeDiagnosticsPlugin)
|
.add_plugins(FrameTimeDiagnosticsPlugin)
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.add_systems(Update, proto_locomotion.run_if(xr_only()))
|
// .add_systems(Update, proto_locomotion.run_if(xr_only()))
|
||||||
.insert_resource(PrototypeLocomotionConfig::default())
|
// .insert_resource(PrototypeLocomotionConfig::default())
|
||||||
.add_systems(Startup, spawn_controllers_example)
|
.add_systems(Startup, spawn_controllers_example)
|
||||||
.add_plugins(HandInputDebugRenderer)
|
// .add_plugins(HandInputDebugRenderer)
|
||||||
.add_systems(
|
// .add_systems(
|
||||||
Update,
|
// Update,
|
||||||
draw_interaction_gizmos
|
// draw_interaction_gizmos
|
||||||
.after(update_interactable_states)
|
// .after(update_interactable_states)
|
||||||
.run_if(xr_only()),
|
// .run_if(xr_only()),
|
||||||
)
|
// )
|
||||||
.add_systems(
|
// .add_systems(
|
||||||
Update,
|
// Update,
|
||||||
draw_socket_gizmos
|
// draw_socket_gizmos
|
||||||
.after(update_interactable_states)
|
// .after(update_interactable_states)
|
||||||
.run_if(xr_only()),
|
// .run_if(xr_only()),
|
||||||
)
|
// )
|
||||||
.add_systems(
|
// .add_systems(
|
||||||
Update,
|
// Update,
|
||||||
interactions
|
// interactions
|
||||||
.before(update_interactable_states)
|
// .before(update_interactable_states)
|
||||||
.run_if(xr_only()),
|
// .run_if(xr_only()),
|
||||||
)
|
// )
|
||||||
.add_systems(
|
// .add_systems(
|
||||||
Update,
|
// Update,
|
||||||
socket_interactions.before(update_interactable_states),
|
// socket_interactions.before(update_interactable_states),
|
||||||
)
|
// )
|
||||||
.add_systems(Update, prototype_interaction_input.run_if(xr_only()))
|
// .add_systems(Update, prototype_interaction_input.run_if(xr_only()))
|
||||||
.add_systems(Update, update_interactable_states)
|
// .add_systems(Update, update_interactable_states)
|
||||||
.add_systems(Update, update_grabbables.after(update_interactable_states))
|
// .add_systems(Update, update_grabbables.after(update_interactable_states))
|
||||||
.add_systems(Update, start_stop_session)
|
.add_systems(Update, start_stop_session)
|
||||||
.add_event::<InteractionEvent>()
|
.add_event::<InteractionEvent>()
|
||||||
.run();
|
.run();
|
||||||
|
|||||||
@@ -447,6 +447,7 @@ pub fn start_xr_session(
|
|||||||
XrSession::Vulkan(session.clone()),
|
XrSession::Vulkan(session.clone()),
|
||||||
resolution.into(),
|
resolution.into(),
|
||||||
swapchain_format.into(),
|
swapchain_format.into(),
|
||||||
|
// TODO: this shouldn't be in here
|
||||||
AtomicBool::new(false).into(),
|
AtomicBool::new(false).into(),
|
||||||
frame_wait.into(),
|
frame_wait.into(),
|
||||||
Swapchain::Vulkan(SwapchainInner {
|
Swapchain::Vulkan(SwapchainInner {
|
||||||
@@ -458,7 +459,7 @@ pub fn start_xr_session(
|
|||||||
.into(),
|
.into(),
|
||||||
XrInput::new(xr_instance, &session.into_any_graphics())?,
|
XrInput::new(xr_instance, &session.into_any_graphics())?,
|
||||||
Vec::default().into(),
|
Vec::default().into(),
|
||||||
// Feels wrong to return a FrameState here, we probably should just wait for the next frame
|
// TODO: Feels wrong to return a FrameState here, we probably should just wait for the next frame
|
||||||
xr::FrameState {
|
xr::FrameState {
|
||||||
predicted_display_time: xr::Time::from_nanos(1),
|
predicted_display_time: xr::Time::from_nanos(1),
|
||||||
predicted_display_period: xr::Duration::from_nanos(1),
|
predicted_display_period: xr::Duration::from_nanos(1),
|
||||||
|
|||||||
65
src/lib.rs
65
src/lib.rs
@@ -1,11 +1,11 @@
|
|||||||
pub mod graphics;
|
pub mod graphics;
|
||||||
pub mod input;
|
pub mod input;
|
||||||
pub mod passthrough;
|
pub mod passthrough;
|
||||||
|
pub mod prelude;
|
||||||
pub mod resource_macros;
|
pub mod resource_macros;
|
||||||
pub mod resources;
|
pub mod resources;
|
||||||
pub mod xr_init;
|
pub mod xr_init;
|
||||||
pub mod xr_input;
|
pub mod xr_input;
|
||||||
pub mod prelude;
|
|
||||||
|
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
|
|
||||||
@@ -28,16 +28,14 @@ use openxr as xr;
|
|||||||
use passthrough::{PassthroughPlugin, XrPassthroughLayer, XrPassthroughState};
|
use passthrough::{PassthroughPlugin, XrPassthroughLayer, XrPassthroughState};
|
||||||
use resources::*;
|
use resources::*;
|
||||||
use xr_init::{
|
use xr_init::{
|
||||||
xr_after_wait_only, xr_only, xr_render_only, CleanupXrData, SetupXrData, XrEarlyInitPlugin,
|
xr_after_wait_only, xr_only, xr_render_only, CleanupRenderWorld, CleanupXrData, SetupXrData,
|
||||||
XrHasWaited, XrShouldRender, XrStatus,
|
XrCleanup, XrEarlyInitPlugin, XrHasWaited, XrPostCleanup, XrShouldRender, XrStatus,
|
||||||
};
|
};
|
||||||
use xr_input::actions::OpenXrActionsPlugin;
|
use xr_input::actions::XrActionsPlugin;
|
||||||
use xr_input::controllers::XrControllerType;
|
|
||||||
use xr_input::hands::emulated::HandEmulationPlugin;
|
use xr_input::hands::emulated::HandEmulationPlugin;
|
||||||
use xr_input::hands::hand_tracking::HandTrackingPlugin;
|
use xr_input::hands::hand_tracking::HandTrackingPlugin;
|
||||||
use xr_input::hands::HandPlugin;
|
use xr_input::hands::HandPlugin;
|
||||||
use xr_input::xr_camera::XrCameraPlugin;
|
use xr_input::xr_camera::XrCameraPlugin;
|
||||||
use xr_input::OpenXrInput;
|
|
||||||
|
|
||||||
const VIEW_TYPE: xr::ViewConfigurationType = xr::ViewConfigurationType::PRIMARY_STEREO;
|
const VIEW_TYPE: xr::ViewConfigurationType = xr::ViewConfigurationType::PRIMARY_STEREO;
|
||||||
|
|
||||||
@@ -112,6 +110,8 @@ impl Plugin for OpenXrPlugin {
|
|||||||
app.add_plugins(RenderPlugin::default());
|
app.add_plugins(RenderPlugin::default());
|
||||||
app.insert_resource(XrStatus::Disabled);
|
app.insert_resource(XrStatus::Disabled);
|
||||||
}
|
}
|
||||||
|
app.add_systems(XrPostCleanup, clean_resources);
|
||||||
|
app.add_systems(XrPostCleanup, || info!("Main World Post Cleanup!"));
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
PreUpdate,
|
PreUpdate,
|
||||||
xr_poll_events.run_if(|status: Res<XrStatus>| *status != XrStatus::NoInstance),
|
xr_poll_events.run_if(|status: Res<XrStatus>| *status != XrStatus::NoInstance),
|
||||||
@@ -164,9 +164,48 @@ impl Plugin for OpenXrPlugin {
|
|||||||
.run_if(not(xr_render_only()))
|
.run_if(not(xr_render_only()))
|
||||||
.in_set(RenderSet::Cleanup),
|
.in_set(RenderSet::Cleanup),
|
||||||
);
|
);
|
||||||
|
render_app.add_systems(
|
||||||
|
Render,
|
||||||
|
clean_resources_render
|
||||||
|
.run_if(resource_exists::<CleanupRenderWorld>)
|
||||||
|
.after(RenderSet::ExtractCommands),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clean_resources_render(mut cmds: &mut World) {
|
||||||
|
let session = cmds.remove_resource::<XrSession>().unwrap();
|
||||||
|
cmds.remove_resource::<XrResolution>();
|
||||||
|
cmds.remove_resource::<XrFormat>();
|
||||||
|
// cmds.remove_resource::<XrSessionRunning>();
|
||||||
|
cmds.remove_resource::<XrFrameWaiter>();
|
||||||
|
cmds.remove_resource::<XrSwapchain>();
|
||||||
|
cmds.remove_resource::<XrInput>();
|
||||||
|
cmds.remove_resource::<XrViews>();
|
||||||
|
cmds.remove_resource::<XrFrameState>();
|
||||||
|
cmds.remove_resource::<CleanupRenderWorld>();
|
||||||
|
// unsafe {
|
||||||
|
// (session.instance().fp().destroy_session)(session.as_raw());
|
||||||
|
// }
|
||||||
|
warn!("Cleanup Resources Render");
|
||||||
|
}
|
||||||
|
fn clean_resources(mut cmds: &mut World) {
|
||||||
|
let session = cmds.remove_resource::<XrSession>().unwrap();
|
||||||
|
cmds.remove_resource::<XrResolution>();
|
||||||
|
cmds.remove_resource::<XrFormat>();
|
||||||
|
// cmds.remove_resource::<XrSessionRunning>();
|
||||||
|
cmds.remove_resource::<XrFrameWaiter>();
|
||||||
|
cmds.remove_resource::<XrSwapchain>();
|
||||||
|
cmds.remove_resource::<XrInput>();
|
||||||
|
cmds.remove_resource::<XrViews>();
|
||||||
|
cmds.remove_resource::<XrFrameState>();
|
||||||
|
// cmds.remove_resource::<CleanupRenderWorld>();
|
||||||
|
// unsafe {
|
||||||
|
// (session.instance().fp().destroy_session)(session.as_raw());
|
||||||
|
// }
|
||||||
|
warn!("Cleanup Resources");
|
||||||
|
}
|
||||||
|
|
||||||
fn xr_skip_frame(
|
fn xr_skip_frame(
|
||||||
xr_swapchain: Res<XrSwapchain>,
|
xr_swapchain: Res<XrSwapchain>,
|
||||||
xr_frame_state: Res<XrFrameState>,
|
xr_frame_state: Res<XrFrameState>,
|
||||||
@@ -217,15 +256,15 @@ impl PluginGroup for DefaultXrPlugins {
|
|||||||
reqeusted_extensions: self.reqeusted_extensions,
|
reqeusted_extensions: self.reqeusted_extensions,
|
||||||
app_info: self.app_info.clone(),
|
app_info: self.app_info.clone(),
|
||||||
})
|
})
|
||||||
.add(XrInitPlugin)
|
.add_after::<OpenXrPlugin, _>(XrInitPlugin)
|
||||||
.add(OpenXrInput::new(XrControllerType::OculusTouch))
|
// .add(XrInput)
|
||||||
.add(OpenXrActionsPlugin)
|
// .add(XrActionsPlugin)
|
||||||
.add(XrCameraPlugin)
|
.add(XrCameraPlugin)
|
||||||
.add_before::<OpenXrPlugin, _>(XrEarlyInitPlugin)
|
.add_before::<OpenXrPlugin, _>(XrEarlyInitPlugin)
|
||||||
.add(HandPlugin)
|
// .add(HandPlugin)
|
||||||
.add(HandTrackingPlugin)
|
// .add(HandTrackingPlugin)
|
||||||
.add(HandEmulationPlugin)
|
// .add(HandEmulationPlugin)
|
||||||
.add(PassthroughPlugin)
|
// .add(PassthroughPlugin)
|
||||||
.add(XrResourcePlugin)
|
.add(XrResourcePlugin)
|
||||||
.set(WindowPlugin {
|
.set(WindowPlugin {
|
||||||
#[cfg(not(target_os = "android"))]
|
#[cfg(not(target_os = "android"))]
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ impl Plugin for XrResourcePlugin {
|
|||||||
app.add_plugins(ExtractResourcePlugin::<XrViews>::default());
|
app.add_plugins(ExtractResourcePlugin::<XrViews>::default());
|
||||||
app.add_plugins(ExtractResourcePlugin::<XrInput>::default());
|
app.add_plugins(ExtractResourcePlugin::<XrInput>::default());
|
||||||
app.add_plugins(ExtractResourcePlugin::<XrEnvironmentBlendMode>::default());
|
app.add_plugins(ExtractResourcePlugin::<XrEnvironmentBlendMode>::default());
|
||||||
app.add_plugins(ExtractResourcePlugin::<XrSessionRunning>::default());
|
// app.add_plugins(ExtractResourcePlugin::<XrSessionRunning>::default());
|
||||||
app.add_plugins(ExtractResourcePlugin::<XrSession>::default());
|
app.add_plugins(ExtractResourcePlugin::<XrSession>::default());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,16 +7,14 @@ use bevy::{
|
|||||||
camera::{ManualTextureView, ManualTextureViews},
|
camera::{ManualTextureView, ManualTextureViews},
|
||||||
extract_resource::{ExtractResource, ExtractResourcePlugin},
|
extract_resource::{ExtractResource, ExtractResourcePlugin},
|
||||||
renderer::{RenderAdapter, RenderDevice, RenderInstance},
|
renderer::{RenderAdapter, RenderDevice, RenderInstance},
|
||||||
|
Render, RenderApp, RenderSet,
|
||||||
},
|
},
|
||||||
window::{PrimaryWindow, RawHandleWrapper},
|
window::{PrimaryWindow, RawHandleWrapper},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
graphics,
|
clean_resources, graphics,
|
||||||
resources::{
|
resources::{OXrSessionSetupInfo, XrFormat, XrInstance, XrResolution, XrSession, XrSwapchain},
|
||||||
OXrSessionSetupInfo, XrFormat, XrInstance, XrResolution, XrSession, XrSessionRunning,
|
|
||||||
XrSwapchain,
|
|
||||||
},
|
|
||||||
LEFT_XR_TEXTURE_HANDLE, RIGHT_XR_TEXTURE_HANDLE,
|
LEFT_XR_TEXTURE_HANDLE, RIGHT_XR_TEXTURE_HANDLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -52,6 +50,9 @@ pub fn xr_after_wait_only() -> impl FnMut(Res<XrHasWaited>) -> bool {
|
|||||||
resource_equals(XrHasWaited(true))
|
resource_equals(XrHasWaited(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Resource, Clone, Copy, ExtractResource)]
|
||||||
|
pub struct CleanupRenderWorld;
|
||||||
|
|
||||||
impl Plugin for XrEarlyInitPlugin {
|
impl Plugin for XrEarlyInitPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
add_schedules(app);
|
add_schedules(app);
|
||||||
@@ -67,6 +68,7 @@ impl Plugin for XrInitPlugin {
|
|||||||
app.add_plugins(ExtractResourcePlugin::<XrStatus>::default());
|
app.add_plugins(ExtractResourcePlugin::<XrStatus>::default());
|
||||||
app.add_plugins(ExtractResourcePlugin::<XrShouldRender>::default());
|
app.add_plugins(ExtractResourcePlugin::<XrShouldRender>::default());
|
||||||
app.add_plugins(ExtractResourcePlugin::<XrHasWaited>::default());
|
app.add_plugins(ExtractResourcePlugin::<XrHasWaited>::default());
|
||||||
|
app.add_plugins(ExtractResourcePlugin::<CleanupRenderWorld>::default());
|
||||||
app.init_resource::<XrShouldRender>();
|
app.init_resource::<XrShouldRender>();
|
||||||
app.init_resource::<XrHasWaited>();
|
app.init_resource::<XrHasWaited>();
|
||||||
app.add_systems(PreUpdate, setup_xr.run_if(on_event::<SetupXrData>()))
|
app.add_systems(PreUpdate, setup_xr.run_if(on_event::<SetupXrData>()))
|
||||||
@@ -80,9 +82,25 @@ impl Plugin for XrInitPlugin {
|
|||||||
stop_xr_session.run_if(on_event::<EndXrSession>()),
|
stop_xr_session.run_if(on_event::<EndXrSession>()),
|
||||||
);
|
);
|
||||||
app.add_systems(XrSetup, setup_manual_texture_views);
|
app.add_systems(XrSetup, setup_manual_texture_views);
|
||||||
|
app.add_systems(XrCleanup, set_cleanup_res);
|
||||||
|
let render_app = app.sub_app_mut(RenderApp);
|
||||||
|
render_app.add_systems(
|
||||||
|
Render,
|
||||||
|
remove_cleanup_res
|
||||||
|
.in_set(RenderSet::Cleanup)
|
||||||
|
.after(clean_resources),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn set_cleanup_res(mut commands: Commands) {
|
||||||
|
info!("Set Cleanup Res");
|
||||||
|
commands.insert_resource(CleanupRenderWorld);
|
||||||
|
}
|
||||||
|
fn remove_cleanup_res(mut commands: Commands) {
|
||||||
|
commands.remove_resource::<CleanupRenderWorld>();
|
||||||
|
}
|
||||||
|
|
||||||
fn setup_manual_texture_views(
|
fn setup_manual_texture_views(
|
||||||
mut manual_texture_views: ResMut<ManualTextureViews>,
|
mut manual_texture_views: ResMut<ManualTextureViews>,
|
||||||
swapchain: Res<XrSwapchain>,
|
swapchain: Res<XrSwapchain>,
|
||||||
@@ -135,7 +153,6 @@ pub(crate) struct CleanupXrData;
|
|||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn start_xr_session(
|
fn start_xr_session(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
mut setup_xr: EventWriter<SetupXrData>,
|
|
||||||
mut status: ResMut<XrStatus>,
|
mut status: ResMut<XrStatus>,
|
||||||
instance: Res<XrInstance>,
|
instance: Res<XrInstance>,
|
||||||
primary_window: Query<&RawHandleWrapper, With<PrimaryWindow>>,
|
primary_window: Query<&RawHandleWrapper, With<PrimaryWindow>>,
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ use super::oculus_touch::ActionSets;
|
|||||||
|
|
||||||
pub use xr::sys::NULL_PATH;
|
pub use xr::sys::NULL_PATH;
|
||||||
|
|
||||||
pub struct OpenXrActionsPlugin;
|
pub struct XrActionsPlugin;
|
||||||
impl Plugin for OpenXrActionsPlugin {
|
impl Plugin for XrActionsPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_systems(PreUpdate, sync_actions.run_if(xr_only()));
|
app.add_systems(PreUpdate, sync_actions.run_if(xr_only()));
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
|
|||||||
@@ -8,7 +8,3 @@ pub struct Handed<T> {
|
|||||||
pub left: T,
|
pub left: T,
|
||||||
pub right: T,
|
pub right: T,
|
||||||
}
|
}
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub enum XrControllerType {
|
|
||||||
OculusTouch,
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -136,8 +136,7 @@ pub fn get_simulated_open_hand_transforms(hand: Hand) -> [Transform; 26] {
|
|||||||
z: 0.01,
|
z: 0.01,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
let result = bones_to_transforms(test_hand_bones, hand);
|
bones_to_transforms(test_hand_bones, hand)
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bones_to_transforms(hand_bones: [Vec3; 26], hand: Hand) -> [Transform; 26] {
|
fn bones_to_transforms(hand_bones: [Vec3; 26], hand: Hand) -> [Transform; 26] {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ pub mod xr_camera;
|
|||||||
|
|
||||||
use crate::resources::{XrInstance, XrSession};
|
use crate::resources::{XrInstance, XrSession};
|
||||||
use crate::xr_init::{xr_only, XrCleanup, XrPostSetup, XrPreSetup, XrSetup};
|
use crate::xr_init::{xr_only, XrCleanup, XrPostSetup, XrPreSetup, XrSetup};
|
||||||
use crate::xr_input::controllers::XrControllerType;
|
|
||||||
use crate::xr_input::oculus_touch::setup_oculus_controller;
|
use crate::xr_input::oculus_touch::setup_oculus_controller;
|
||||||
use crate::xr_input::xr_camera::{xr_camera_head_sync, Eye, XRProjection, XrCameraBundle};
|
use crate::xr_input::xr_camera::{xr_camera_head_sync, Eye, XRProjection, XrCameraBundle};
|
||||||
use crate::{locate_views, xr_wait_frame};
|
use crate::{locate_views, xr_wait_frame};
|
||||||
@@ -31,7 +30,7 @@ use bevy::transform::TransformSystem;
|
|||||||
use bevy::utils::HashMap;
|
use bevy::utils::HashMap;
|
||||||
use openxr::Binding;
|
use openxr::Binding;
|
||||||
|
|
||||||
use self::actions::{setup_oxr_actions, OpenXrActionsPlugin};
|
use self::actions::{setup_oxr_actions, XrActionsPlugin};
|
||||||
use self::oculus_touch::{init_subaction_path, post_action_setup_oculus_controller, ActionSets};
|
use self::oculus_touch::{init_subaction_path, post_action_setup_oculus_controller, ActionSets};
|
||||||
use self::trackers::{
|
use self::trackers::{
|
||||||
adopt_open_xr_trackers, update_open_xr_controllers, OpenXRLeftEye, OpenXRRightEye,
|
adopt_open_xr_trackers, update_open_xr_controllers, OpenXRLeftEye, OpenXRRightEye,
|
||||||
@@ -40,30 +39,17 @@ use self::trackers::{
|
|||||||
use self::xr_camera::{/* GlobalTransformExtract, TransformExtract, */ XrCamera};
|
use self::xr_camera::{/* GlobalTransformExtract, TransformExtract, */ XrCamera};
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct OpenXrInput {
|
pub struct XrInput;
|
||||||
pub controller_type: XrControllerType,
|
|
||||||
}
|
|
||||||
#[derive(Clone, Copy, Debug, Ord, PartialOrd, Eq, PartialEq, Component)]
|
#[derive(Clone, Copy, Debug, Ord, PartialOrd, Eq, PartialEq, Component)]
|
||||||
pub enum Hand {
|
pub enum Hand {
|
||||||
Left,
|
Left,
|
||||||
Right,
|
Right,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OpenXrInput {
|
impl Plugin for XrInput {
|
||||||
pub fn new(controller_type: XrControllerType) -> Self {
|
|
||||||
Self { controller_type }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Plugin for OpenXrInput {
|
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_systems(XrPostSetup, post_action_setup_oculus_controller);
|
app.add_systems(XrPostSetup, post_action_setup_oculus_controller);
|
||||||
// why only when the controller is oculus? that is still backed by generic actions
|
app.add_systems(XrSetup, setup_oculus_controller);
|
||||||
match self.controller_type {
|
|
||||||
XrControllerType::OculusTouch => {
|
|
||||||
app.add_systems(XrSetup, setup_oculus_controller);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//adopt any new trackers
|
//adopt any new trackers
|
||||||
app.add_systems(PreUpdate, adopt_open_xr_trackers.run_if(xr_only()));
|
app.add_systems(PreUpdate, adopt_open_xr_trackers.run_if(xr_only()));
|
||||||
// app.add_systems(PreUpdate, action_set_system.run_if(xr_only()));
|
// app.add_systems(PreUpdate, action_set_system.run_if(xr_only()));
|
||||||
|
|||||||
Reference in New Issue
Block a user