particles: show them only in augmented reality

This commit is contained in:
yuni 2024-09-17 16:36:01 +02:00
parent fbc416796e
commit 3e8d4bf6d7

View file

@ -128,6 +128,7 @@ pub fn setup(
pub fn spawn_effects( pub fn spawn_effects(
mut commands: Commands, mut commands: Commands,
settings: Res<var::Settings>,
mut er_effect: EventReader<SpawnEffectEvent>, mut er_effect: EventReader<SpawnEffectEvent>,
mut materials: ResMut<Assets<StandardMaterial>>, mut materials: ResMut<Assets<StandardMaterial>>,
mut meshes: ResMut<Assets<Mesh>>, mut meshes: ResMut<Assets<Mesh>>,
@ -173,6 +174,7 @@ pub fn spawn_effects(
let texture = asset_server.load("textures/exhaust.png"); let texture = asset_server.load("textures/exhaust.png");
commands.spawn(( commands.spawn((
IsEffect, IsEffect,
hud::ToggleableHudElement,
RigidBody::Kinematic, RigidBody::Kinematic,
bevy::pbr::NotShadowCaster, bevy::pbr::NotShadowCaster,
pos, pos,
@ -205,6 +207,11 @@ pub fn spawn_effects(
alpha_mode: AlphaMode::Blend, alpha_mode: AlphaMode::Blend,
..Default::default() ..Default::default()
}), }),
visibility: if settings.hud_active {
Visibility::Inherited
} else {
Visibility::Hidden
},
..default() ..default()
}, },
)); ));