From f7dd83ce604494550b03a7b3ff09d5e458f01950 Mon Sep 17 00:00:00 2001 From: Silc Renew Date: Sun, 21 Aug 2022 09:30:18 +0900 Subject: Fix Quaternion Tween and implement ease baker --- core/math/quaternion.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core') 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 { -- cgit v1.2.3