diff options
| author | HampusM <hampus@hampusmat.com> | 2026-09-19 19:45:30 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-09-19 19:45:30 +0200 |
| commit | e118bc4dbabc3690f5e6a5fae3003671890c0bab (patch) | |
| tree | dacda2b4d3a9cb1bf73ef2b5c0b5b1212d99555a /engine/src | |
| parent | 53815e69c4898bdd7afb198d8b476efa6cbb978f (diff) | |
Diffstat (limited to 'engine/src')
| -rw-r--r-- | engine/src/data_types/vector.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/engine/src/data_types/vector.rs b/engine/src/data_types/vector.rs index 3d261bd..915599a 100644 --- a/engine/src/data_types/vector.rs +++ b/engine/src/data_types/vector.rs @@ -189,9 +189,11 @@ impl Vec3<f32> pub fn into_deg_angles(self) -> Angles<f32> { + let Self { x, y, z } = self.normalize(); + Angles { - yaw: self.z.atan2(self.x).to_degrees(), - pitch: self.y.asin().to_degrees(), + yaw: z.atan2(x).to_degrees(), + pitch: y.asin().to_degrees(), roll: 0.0, } } |
