always make sure camera z is at 999, make sure character z at least at 1

This commit is contained in:
Nixon 2022-08-24 16:54:15 +08:00
parent 135fc268aa
commit 972cd26876

View file

@ -113,9 +113,11 @@ pub fn spawn_character(
selected_character_id: &mut Mut<SelectedCharacterId>,
character_id_list: &mut Mut<CharacterIdList>,
audio: &Res<crossbeam_channel::Sender<AudioMsg>>,
transform: Transform,
mut transform: Transform,
color: Color,
) {
transform.translation.z = transform.translation.z.max(1.0);
let character_id = CharacterId(
character_id_list
.0
@ -325,6 +327,7 @@ fn move_camera(
camera_transform.translation = camera_transform.translation.lerp(transform.translation, time.delta_seconds() * FOLLOW_SPEED);
// prevent camera from going too low
camera_transform.translation.y = camera_transform.translation.y.max(half_height-MARGIN);
camera_transform.translation.z = 999.0;
}
}
}