ensure particle are always behind characters

This commit is contained in:
Nixon 2022-08-27 17:48:19 +08:00
parent 9fd54a5755
commit 4af0642b16
2 changed files with 10 additions and 1 deletions

View file

@ -124,16 +124,24 @@ pub fn spawn_characters<I: IntoIterator<Item = (Transform, Color)>>(
characters: I, characters: I,
) { ) {
const Z_INCREMENT: f32 = 0.01;
let mut curr_z: f32 = Z_INCREMENT;
for (i, (transform, color)) in characters.into_iter().enumerate() { for (i, (transform, color)) in characters.into_iter().enumerate() {
spawn_character( spawn_character(
commands, commands,
character_meshes, character_meshes,
materials, materials,
audio, audio,
transform, {
let mut new_transform: Transform = transform;
new_transform.translation.z = curr_z;
new_transform
},
color, color,
i == 0, i == 0,
); );
curr_z += Z_INCREMENT;
} }
} }

View file

@ -134,5 +134,6 @@ fn particle_effect_system(
/ particle_effect.radius_squared, / particle_effect.radius_squared,
); );
} }
transform.translation.z = 0.005;
} }
} }