summaryrefslogtreecommitdiff
path: root/engine/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-09-19 19:45:30 +0200
committerHampusM <hampus@hampusmat.com>2026-09-19 19:45:30 +0200
commite118bc4dbabc3690f5e6a5fae3003671890c0bab (patch)
treedacda2b4d3a9cb1bf73ef2b5c0b5b1212d99555a /engine/src
parent53815e69c4898bdd7afb198d8b476efa6cbb978f (diff)
fix(engine): prevent Vec3::into_deg_angles creating angles from unnormalized vecHEADmaster
Diffstat (limited to 'engine/src')
-rw-r--r--engine/src/data_types/vector.rs6
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,
}
}