fix camera + light
This commit is contained in:
parent
3226bbc411
commit
7f39a45b92
|
@ -72,23 +72,22 @@ pub fn track_players(
|
|||
max_z = Some(t.z);
|
||||
}
|
||||
}
|
||||
if let Some(target) = max_y.and_then(|max_y| {
|
||||
let target = max_y.and_then(|max_y| {
|
||||
let dist = 8.0f32.max(
|
||||
max_x? - min_x? / 2.0
|
||||
(max_x? - min_x?) / 2.0
|
||||
).max(
|
||||
(max_z? - min_z?) / 4.0
|
||||
);
|
||||
Some(Vec3::new(
|
||||
(min_x? + max_x?) / 2.0 + OFFSET_X,
|
||||
(min_x? + max_x?) / 2.0 + OFFSET_X - dist / 2.0,
|
||||
max_y + OFFSET_Y,
|
||||
(min_z? + max_z?) / 2.0 + OFFSET_Z + dist
|
||||
max_z? + OFFSET_Z + dist,
|
||||
))
|
||||
}) {
|
||||
}).unwrap_or_else(|| Vec3::new(OFFSET_X, OFFSET_Y, OFFSET_Z));
|
||||
for mut camera_transform in queries.q1().iter_mut() {
|
||||
let t = &mut camera_transform.translation;
|
||||
*t = *t + time.delta_seconds() * (target - *t) / 2.0;
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(light_pos) = max_y.and_then(|max_y| {
|
||||
Some(Vec3::new(
|
||||
|
|
Loading…
Reference in New Issue