Fix sun & moon movement direction

They were rising on the west and setting on the east
This commit is contained in:
Andrii Zymohliad 2020-11-27 23:17:59 +02:00
parent 9065d0ca02
commit 8a6f08df91

View File

@ -139,12 +139,12 @@ impl Globals {
pub fn get_sun_dir(time_of_day: f64) -> Vec3<f32> {
let angle_rad = Self::get_angle_rad(time_of_day);
Vec3::new(angle_rad.sin(), 0.0, angle_rad.cos())
Vec3::new(-angle_rad.sin(), 0.0, angle_rad.cos())
}
pub fn get_moon_dir(time_of_day: f64) -> Vec3<f32> {
let angle_rad = Self::get_angle_rad(time_of_day);
-Vec3::new(angle_rad.sin(), 0.0, angle_rad.cos() - 0.5).normalized()
-Vec3::new(-angle_rad.sin(), 0.0, angle_rad.cos() - 0.5).normalized()
}
}