diff --git a/crates/bevy_openxr/examples/actions.rs b/crates/bevy_openxr/examples/actions.rs index eb7c6d9..81070f8 100644 --- a/crates/bevy_openxr/examples/actions.rs +++ b/crates/bevy_openxr/examples/actions.rs @@ -139,7 +139,7 @@ fn handle_flight_input( let view = views.first(); match view { Some(v) => { - let reference_quat = v.pose.orientation.to_quat(); + let reference_quat = root_position.rotation.inverse() * v.pose.orientation.to_quat(); let locomotion_vector = reference_quat.mul_vec3(input_vector); root_position.translation += diff --git a/crates/bevy_xr/src/camera.rs b/crates/bevy_xr/src/camera.rs index b779f51..e3b0250 100644 --- a/crates/bevy_xr/src/camera.rs +++ b/crates/bevy_xr/src/camera.rs @@ -6,9 +6,7 @@ use bevy::ecs::component::{Component, StorageType}; use bevy::ecs::reflect::ReflectComponent; use bevy::ecs::schedule::IntoSystemConfigs; use bevy::math::{Mat4, Vec3A}; -use bevy::pbr::{ - build_directional_light_cascades, clear_directional_light_cascades, SimulationLightSystems, -}; +use bevy::pbr::{PbrPlugin, PbrProjectionPlugin}; use bevy::prelude::Projection; use bevy::reflect::std_traits::ReflectDefault; use bevy::reflect::Reflect; @@ -30,12 +28,9 @@ impl Plugin for XrCameraPlugin { .after(TransformSystem::TransformPropagate) .before(VisibilitySystems::UpdateFrusta), ); - app.add_systems( - PostUpdate, - build_directional_light_cascades:: - .in_set(SimulationLightSystems::UpdateDirectionalLightCascades) - .after(clear_directional_light_cascades), - ); + if app.is_plugin_added::() { + app.add_plugins(PbrProjectionPlugin::::default()); + } app.add_plugins(( ExtractComponentPlugin::::default(), ExtractComponentPlugin::::default(),