From 78c2765e4594273a7a7b22910334accbc430c019 Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Mon, 11 Oct 2021 19:05:33 -0700 Subject: [PATCH] Reverse order so that the cubic slerp doesn't wobble. See Github KhronosGroup/glTF pr number 2018 --- core/math/quaternion.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/math/quaternion.cpp b/core/math/quaternion.cpp index 3f1d2c58e585..7e399ddd7561 100644 --- a/core/math/quaternion.cpp +++ b/core/math/quaternion.cpp @@ -178,10 +178,9 @@ Quaternion Quaternion::cubic_slerp(const Quaternion &p_b, const Quaternion &p_pr ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The start quaternion must be normalized."); ERR_FAIL_COND_V_MSG(!p_b.is_normalized(), Quaternion(), "The end quaternion must be normalized."); #endif - //the only way to do slerp :| real_t t2 = (1.0 - p_weight) * p_weight * 2; - Quaternion sp = this->slerp(p_b, p_weight); - Quaternion sq = p_pre_a.slerpni(p_post_b, p_weight); + Quaternion sp = p_pre_a.slerp(p_post_b, p_weight); + Quaternion sq = this->slerpni(p_b, p_weight); return sp.slerpni(sq, t2); }