add plugin by default and fix compile errors
Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
use crate::{init::OxrPreUpdateSet, resources::OxrSession};
|
use crate::{init::OxrPreUpdateSet, resources::OxrSession};
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_xr::session::{session_running, status_changed_to};
|
use bevy_xr::session::session_running;
|
||||||
|
|
||||||
impl Plugin for OxrActionSyncingPlugin {
|
impl Plugin for OxrActionSyncingPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_event::<OxrAttachActionSet>();
|
app.add_event::<OxrSyncActionSet>();
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
PreUpdate,
|
PreUpdate,
|
||||||
sync_sets
|
sync_sets
|
||||||
@@ -18,14 +18,14 @@ fn sync_sets(session: Res<OxrSession>, mut events: EventReader<OxrSyncActionSet>
|
|||||||
let sets = events
|
let sets = events
|
||||||
.read()
|
.read()
|
||||||
.map(|v| &v.0)
|
.map(|v| &v.0)
|
||||||
.map(|s| openxr::ActionSet::from(s))
|
.map(openxr::ActiveActionSet::new)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
if sets.is_empty() {
|
if sets.is_empty() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(err) = session.sync_actions(sets) {
|
if let Err(err) = session.sync_actions(&sets) {
|
||||||
warn!("error while syncing actionsets: {}", err.to_string());
|
warn!("error while syncing actionsets: {}", err.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ pub fn add_xr_plugins<G: PluginGroup>(plugins: G) -> PluginGroupBuilder {
|
|||||||
.add(XrCameraPlugin)
|
.add(XrCameraPlugin)
|
||||||
.add(action_set_attaching::OxrActionAttachingPlugin)
|
.add(action_set_attaching::OxrActionAttachingPlugin)
|
||||||
.add(action_binding::OxrActionBindingPlugin)
|
.add(action_binding::OxrActionBindingPlugin)
|
||||||
|
.add(action_set_syncing::OxrActionSyncingPlugin)
|
||||||
// .add(XrActionPlugin)
|
// .add(XrActionPlugin)
|
||||||
.set(WindowPlugin {
|
.set(WindowPlugin {
|
||||||
primary_window: Some(Window {
|
primary_window: Some(Window {
|
||||||
|
|||||||
Reference in New Issue
Block a user