Fix panic on Transform::lerp due to rotation not being normalized
This commit is contained in:
parent
2805399fe4
commit
0a0ac0ae6f
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue