diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-23 09:19:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-23 09:19:21 +0200 |
commit | b9919fd87dbac180f2d3ade766a8d074d4224dfe (patch) | |
tree | 2fa6d1397ea2b7539097b305bf178d3d7d41cfa1 /core/math | |
parent | 3f3ade9e5b19e8d13169a9af45a80877b3fa1c65 (diff) | |
parent | f7dd83ce604494550b03a7b3ff09d5e458f01950 (diff) |
Merge pull request #64678 from TokageItLab/implement-ease-baker
Fix Quaternion Tween and add Easing baker to AnimationTrackEditor
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/quaternion.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/math/quaternion.cpp b/core/math/quaternion.cpp index 36358f6feb..c836a82e37 100644 --- a/core/math/quaternion.cpp +++ b/core/math/quaternion.cpp @@ -112,10 +112,11 @@ Quaternion Quaternion::exp() const { Quaternion src = *this; Vector3 src_v = Vector3(src.x, src.y, src.z); real_t theta = src_v.length(); - if (theta < CMP_EPSILON) { + src_v = src_v.normalized(); + if (theta < CMP_EPSILON || !src_v.is_normalized()) { return Quaternion(0, 0, 0, 1); } - return Quaternion(src_v.normalized(), theta); + return Quaternion(src_v, theta); } Quaternion Quaternion::slerp(const Quaternion &p_to, const real_t &p_weight) const { |