Skip to content

Commit

Permalink
made setup_xr public (#56)
Browse files Browse the repository at this point in the history
* made setup_xr public

* made the action syncing system public too
  • Loading branch information
Schmarni-Dev authored Dec 11, 2023
1 parent 45f5d8c commit 2e492e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/xr_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ fn add_schedules(app: &mut App) {
}
}

fn setup_xr(world: &mut World) {
pub fn setup_xr(world: &mut World) {
world.run_schedule(XrPreSetup);
world.run_schedule(XrSetup);
world.run_schedule(XrPrePostSetup);
Expand Down
16 changes: 8 additions & 8 deletions src/xr_input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ pub mod prototype_locomotion;
pub mod trackers;
pub mod xr_camera;

use crate::xr_init::{XrPostSetup, XrSetup, xr_only};
use crate::resources::{XrInstance, XrSession};
use crate::xr_begin_frame;
use crate::xr_init::{xr_only, XrPostSetup, XrSetup};
use crate::xr_input::controllers::XrControllerType;
use crate::xr_input::oculus_touch::setup_oculus_controller;
use crate::xr_input::xr_camera::{xr_camera_head_sync, Eye, XRProjection, XrCameraBundle};
use bevy::app::{App, PostUpdate, Startup};
use bevy::log::{warn, info};
use bevy::log::{info, warn};
use bevy::prelude::{BuildChildren, Component, Deref, DerefMut, IntoSystemConfigs, Resource};
use bevy::prelude::{Commands, Plugin, PreUpdate, Quat, Res, SpatialBundle, Update, Vec3};
use bevy::render::camera::CameraProjectionPlugin;
Expand Down Expand Up @@ -52,10 +52,7 @@ impl Plugin for OpenXrInput {
fn build(&self, app: &mut App) {
app.add_plugins(CameraProjectionPlugin::<XRProjection>::default());
app.add_plugins(OpenXrActionsPlugin);
app.add_systems(
XrPostSetup,
post_action_setup_oculus_controller,
);
app.add_systems(XrPostSetup, post_action_setup_oculus_controller);
match self.controller_type {
XrControllerType::OculusTouch => {
app.add_systems(XrSetup, setup_oculus_controller);
Expand All @@ -64,7 +61,10 @@ impl Plugin for OpenXrInput {
//adopt any new trackers
app.add_systems(PreUpdate, adopt_open_xr_trackers.run_if(xr_only()));
app.add_systems(PreUpdate, action_set_system);
app.add_systems(PreUpdate, xr_camera_head_sync.run_if(xr_only()).after(xr_begin_frame));
app.add_systems(
PreUpdate,
xr_camera_head_sync.run_if(xr_only()).after(xr_begin_frame),
);
//update controller trackers
app.add_systems(Update, update_open_xr_controllers.run_if(xr_only()));
app.add_systems(
Expand Down Expand Up @@ -103,7 +103,7 @@ fn setup_xr_cameras(mut commands: Commands) {
commands.entity(tracking_root).push_children(&[right, left]);
}

fn action_set_system(action_sets: Res<ActionSets>, session: Res<XrSession>) {
pub fn action_set_system(action_sets: Res<ActionSets>, session: Res<XrSession>) {
let mut active_action_sets = vec![];
for i in &action_sets.0 {
active_action_sets.push(openxr::ActiveActionSet::new(i));
Expand Down

0 comments on commit 2e492e1

Please sign in to comment.