summaryrefslogtreecommitdiff
path: root/core/math
diff options
context:
space:
mode:
authorSilc Renew <tokage.it.lab@gmail.com>2022-08-21 09:30:18 +0900
committerSilc Renew <tokage.it.lab@gmail.com>2022-08-22 19:04:58 +0900
commitf7dd83ce604494550b03a7b3ff09d5e458f01950 (patch)
tree42ba1a4642a7558de052eb2957d277b37f3e87b3 /core/math
parent0c5f254956f0115e363ce08045dd178dc30b54f8 (diff)
Fix Quaternion Tween and implement ease baker
Diffstat (limited to 'core/math')
-rw-r--r--core/math/quaternion.cpp5
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 {