fixed controllers (#54)
* basics done? now to the fun part: changing the ENTIRE lib to work with xr and non xr * updated stuff and renamed file * actually add the renamed file into git lol :3 * made lib fallback to flat when no runtime is found but can't compile with default settings under those circumstances * Update Cargo.toml * fixed version conflict * ununcommented the action sync system and changed other small stuff
This commit is contained in:
@@ -139,6 +139,7 @@ impl Plugin for OpenXrPlugin {
|
|||||||
RenderInstance(Arc::new(instance)),
|
RenderInstance(Arc::new(instance)),
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
app.insert_resource(XrEnableStatus::Enabled);
|
||||||
} else {
|
} else {
|
||||||
app.add_plugins(RenderPlugin::default());
|
app.add_plugins(RenderPlugin::default());
|
||||||
app.insert_resource(XrEnableStatus::Disabled);
|
app.insert_resource(XrEnableStatus::Disabled);
|
||||||
@@ -155,12 +156,6 @@ impl Plugin for OpenXrPlugin {
|
|||||||
fn finish(&self, app: &mut App) {
|
fn finish(&self, app: &mut App) {
|
||||||
// TODO: Split this up into the indevidual resources
|
// TODO: Split this up into the indevidual resources
|
||||||
if let Some(data) = app.world.get_resource::<XrRenderData>().cloned() {
|
if let Some(data) = app.world.get_resource::<XrRenderData>().cloned() {
|
||||||
// just calling this stuff because I already had the code, so...
|
|
||||||
app.insert_resource(XrEnableStatus::Enabled);
|
|
||||||
app.world.send_event(XrEnableRequest::TryEnable);
|
|
||||||
app.world.run_system_once(update_xr_stuff);
|
|
||||||
app.insert_resource(XrEnableStatus::Enabled);
|
|
||||||
//
|
|
||||||
let hands = data.xr_instance.exts().ext_hand_tracking.is_some()
|
let hands = data.xr_instance.exts().ext_hand_tracking.is_some()
|
||||||
&& data
|
&& data
|
||||||
.xr_instance
|
.xr_instance
|
||||||
|
|||||||
@@ -107,6 +107,9 @@ impl Plugin for RenderRestartPlugin {
|
|||||||
.insert_resource(ForceMain)
|
.insert_resource(ForceMain)
|
||||||
.add_event::<XrEnableRequest>()
|
.add_event::<XrEnableRequest>()
|
||||||
.add_event::<XrEnableStatus>()
|
.add_event::<XrEnableStatus>()
|
||||||
|
.add_systems(PreStartup, xr_presetup.run_if(xr_only()))
|
||||||
|
.add_systems(Startup, xr_setup.run_if(xr_only()))
|
||||||
|
.add_systems(PostStartup, xr_postsetup.run_if(xr_only()))
|
||||||
.add_systems(
|
.add_systems(
|
||||||
PostUpdate,
|
PostUpdate,
|
||||||
update_xr_stuff.run_if(on_event::<XrEnableRequest>()),
|
update_xr_stuff.run_if(on_event::<XrEnableRequest>()),
|
||||||
@@ -119,7 +122,7 @@ impl Plugin for RenderRestartPlugin {
|
|||||||
cleanup_xr.run_if(resource_exists_and_equals(XrNextEnabledState::Disabled)),
|
cleanup_xr.run_if(resource_exists_and_equals(XrNextEnabledState::Disabled)),
|
||||||
// handle_xr_enable_requests,
|
// handle_xr_enable_requests,
|
||||||
apply_deferred,
|
apply_deferred,
|
||||||
setup_xr/* .run_if(resource_exists_and_equals(XrEnableStatus::Enabled)) */,
|
setup_xr, /* .run_if(resource_exists_and_equals(XrEnableStatus::Enabled)) */
|
||||||
)
|
)
|
||||||
.chain(),
|
.chain(),
|
||||||
)
|
)
|
||||||
@@ -151,15 +154,22 @@ fn add_schedules(app: &mut App) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn xr_presetup(world: &mut World) {
|
||||||
|
world.run_schedule(XrPreSetup);
|
||||||
|
}
|
||||||
|
fn xr_setup(world: &mut World) {
|
||||||
|
world.run_schedule(XrSetup);
|
||||||
|
}
|
||||||
|
fn xr_postsetup(world: &mut World) {
|
||||||
|
world.run_schedule(XrPrePostSetup);
|
||||||
|
world.run_schedule(XrPostSetup);
|
||||||
|
}
|
||||||
|
|
||||||
fn setup_xr(world: &mut World) {
|
fn setup_xr(world: &mut World) {
|
||||||
world.run_schedule(XrPreSetup);
|
world.run_schedule(XrPreSetup);
|
||||||
info!("PreSetup Done");
|
|
||||||
world.run_schedule(XrSetup);
|
world.run_schedule(XrSetup);
|
||||||
info!("Setup Done");
|
|
||||||
world.run_schedule(XrPrePostSetup);
|
world.run_schedule(XrPrePostSetup);
|
||||||
info!("PrePostSetup Done");
|
|
||||||
world.run_schedule(XrPostSetup);
|
world.run_schedule(XrPostSetup);
|
||||||
info!("PostSetup Done");
|
|
||||||
}
|
}
|
||||||
fn cleanup_xr(world: &mut World) {
|
fn cleanup_xr(world: &mut World) {
|
||||||
world.run_schedule(XrPreCleanup);
|
world.run_schedule(XrPreCleanup);
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ impl Plugin for OpenXrActionsPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn setup_oxr_actions(world: &mut World) {
|
pub fn setup_oxr_actions(world: &mut World) {
|
||||||
info!("huh?!");
|
|
||||||
let actions = world.remove_resource::<SetupActionSets>().unwrap();
|
let actions = world.remove_resource::<SetupActionSets>().unwrap();
|
||||||
let instance = world.get_resource::<XrInstance>().unwrap();
|
let instance = world.get_resource::<XrInstance>().unwrap();
|
||||||
let session = world.get_resource::<XrSession>().unwrap();
|
let session = world.get_resource::<XrSession>().unwrap();
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ impl Plugin for OpenXrInput {
|
|||||||
}
|
}
|
||||||
//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);
|
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
|
//update controller trackers
|
||||||
app.add_systems(Update, update_open_xr_controllers.run_if(xr_only()));
|
app.add_systems(Update, update_open_xr_controllers.run_if(xr_only()));
|
||||||
@@ -89,7 +89,6 @@ fn setup_binding_recommendations(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn setup_xr_cameras(mut commands: Commands) {
|
fn setup_xr_cameras(mut commands: Commands) {
|
||||||
info!("WTF?!");
|
|
||||||
//this needs to do the whole xr tracking volume not just cameras
|
//this needs to do the whole xr tracking volume not just cameras
|
||||||
//get the root?
|
//get the root?
|
||||||
let tracking_root = commands
|
let tracking_root = commands
|
||||||
|
|||||||
Reference in New Issue
Block a user