Skip to content

Commit 02ca015

Browse files
authored
Merge pull request #171 from Schmarni-Dev/pbr
only add systems that depend on pbr when the PbrPlugin is added
2 parents 40e9fed + 6d515f3 commit 02ca015

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

crates/bevy_openxr/examples/actions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ fn handle_flight_input(
139139
let view = views.first();
140140
match view {
141141
Some(v) => {
142-
let reference_quat = v.pose.orientation.to_quat();
142+
let reference_quat = root_position.rotation.inverse() * v.pose.orientation.to_quat();
143143
let locomotion_vector = reference_quat.mul_vec3(input_vector);
144144

145145
root_position.translation +=

crates/bevy_xr/src/camera.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ use bevy::ecs::component::{Component, StorageType};
66
use bevy::ecs::reflect::ReflectComponent;
77
use bevy::ecs::schedule::IntoSystemConfigs;
88
use bevy::math::{Mat4, Vec3A};
9-
use bevy::pbr::{
10-
build_directional_light_cascades, clear_directional_light_cascades, SimulationLightSystems,
11-
};
9+
use bevy::pbr::{PbrPlugin, PbrProjectionPlugin};
1210
use bevy::prelude::Projection;
1311
use bevy::reflect::std_traits::ReflectDefault;
1412
use bevy::reflect::Reflect;
@@ -30,12 +28,9 @@ impl Plugin for XrCameraPlugin {
3028
.after(TransformSystem::TransformPropagate)
3129
.before(VisibilitySystems::UpdateFrusta),
3230
);
33-
app.add_systems(
34-
PostUpdate,
35-
build_directional_light_cascades::<XrProjection>
36-
.in_set(SimulationLightSystems::UpdateDirectionalLightCascades)
37-
.after(clear_directional_light_cascades),
38-
);
31+
if app.is_plugin_added::<PbrPlugin>() {
32+
app.add_plugins(PbrProjectionPlugin::<XrProjection>::default());
33+
}
3934
app.add_plugins((
4035
ExtractComponentPlugin::<XrProjection>::default(),
4136
ExtractComponentPlugin::<XrCamera>::default(),

0 commit comments

Comments
 (0)