Merge pull request #171 from Schmarni-Dev/pbr
only add systems that depend on pbr when the PbrPlugin is added
This commit is contained in:
@@ -139,7 +139,7 @@ fn handle_flight_input(
|
|||||||
let view = views.first();
|
let view = views.first();
|
||||||
match view {
|
match view {
|
||||||
Some(v) => {
|
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);
|
let locomotion_vector = reference_quat.mul_vec3(input_vector);
|
||||||
|
|
||||||
root_position.translation +=
|
root_position.translation +=
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ use bevy::ecs::component::{Component, StorageType};
|
|||||||
use bevy::ecs::reflect::ReflectComponent;
|
use bevy::ecs::reflect::ReflectComponent;
|
||||||
use bevy::ecs::schedule::IntoSystemConfigs;
|
use bevy::ecs::schedule::IntoSystemConfigs;
|
||||||
use bevy::math::{Mat4, Vec3A};
|
use bevy::math::{Mat4, Vec3A};
|
||||||
use bevy::pbr::{
|
use bevy::pbr::{PbrPlugin, PbrProjectionPlugin};
|
||||||
build_directional_light_cascades, clear_directional_light_cascades, SimulationLightSystems,
|
|
||||||
};
|
|
||||||
use bevy::prelude::Projection;
|
use bevy::prelude::Projection;
|
||||||
use bevy::reflect::std_traits::ReflectDefault;
|
use bevy::reflect::std_traits::ReflectDefault;
|
||||||
use bevy::reflect::Reflect;
|
use bevy::reflect::Reflect;
|
||||||
@@ -30,12 +28,9 @@ impl Plugin for XrCameraPlugin {
|
|||||||
.after(TransformSystem::TransformPropagate)
|
.after(TransformSystem::TransformPropagate)
|
||||||
.before(VisibilitySystems::UpdateFrusta),
|
.before(VisibilitySystems::UpdateFrusta),
|
||||||
);
|
);
|
||||||
app.add_systems(
|
if app.is_plugin_added::<PbrPlugin>() {
|
||||||
PostUpdate,
|
app.add_plugins(PbrProjectionPlugin::<XrProjection>::default());
|
||||||
build_directional_light_cascades::<XrProjection>
|
}
|
||||||
.in_set(SimulationLightSystems::UpdateDirectionalLightCascades)
|
|
||||||
.after(clear_directional_light_cascades),
|
|
||||||
);
|
|
||||||
app.add_plugins((
|
app.add_plugins((
|
||||||
ExtractComponentPlugin::<XrProjection>::default(),
|
ExtractComponentPlugin::<XrProjection>::default(),
|
||||||
ExtractComponentPlugin::<XrCamera>::default(),
|
ExtractComponentPlugin::<XrCamera>::default(),
|
||||||
|
|||||||
Reference in New Issue
Block a user