diff --git a/src/math/transform.rs b/src/math/transform.rs index 8da8fae..2b5be2b 100755 --- a/src/math/transform.rs +++ b/src/math/transform.rs @@ -71,7 +71,7 @@ impl Transform { /// Rotate this transform using a Quaternion pub fn rotate(&mut self, rotation: Quat) { - self.rotation = rotation * self.rotation; + self.rotation = (rotation * self.rotation).normalize(); } pub fn rotate_x(&mut self, angle: Angle) { @@ -96,7 +96,8 @@ impl Transform { if alpha.is_finite() { let mut res = self.clone(); res.translation = self.translation.lerp(rhs.translation, alpha); - res.rotation = self.rotation.lerp(rhs.rotation, alpha); + // normalize rotation here to avoid panics + res.rotation = self.rotation.lerp(rhs.rotation.normalize(), alpha); res.scale = self.scale.lerp(rhs.scale, alpha); res } else {