diff options
author | Silc Renew <tokage.it.lab@gmail.com> | 2022-08-21 09:30:18 +0900 |
---|---|---|
committer | Silc Renew <tokage.it.lab@gmail.com> | 2022-08-22 19:04:58 +0900 |
commit | f7dd83ce604494550b03a7b3ff09d5e458f01950 (patch) | |
tree | 42ba1a4642a7558de052eb2957d277b37f3e87b3 /core/math | |
parent | 0c5f254956f0115e363ce08045dd178dc30b54f8 (diff) |
Fix Quaternion Tween and implement ease baker
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 c681c60694..1de7e47466 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 { |