Skip to content

Commit

Permalink
Reverse order so that the cubic slerp doesn't wobble.
Browse files Browse the repository at this point in the history
See Github KhronosGroup/glTF pr number 2018
  • Loading branch information
fire committed Oct 12, 2021
1 parent cb85ef6 commit 78c2765
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions core/math/quaternion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 78c2765

Please sign in to comment.