diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-03-30 08:23:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-30 08:23:50 +0200 |
commit | 5f49e0c7efa13ada96f5150a690d884b1f68c50f (patch) | |
tree | 5a227226f98aed89d81270fbbf80794fae6761a4 | |
parent | db31445b905d94f055ffd210aee6d93cc39b8c96 (diff) | |
parent | 91967229355d381ee2b4d9d6ab126a3c5e8b2a84 (diff) |
Merge pull request #47470 from rafallus/fix/quat-mult
Fix Quat multiplication
-rw-r--r-- | core/math/quat.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/math/quat.cpp b/core/math/quat.cpp index a9a21a1ba3..6f13e04027 100644 --- a/core/math/quat.cpp +++ b/core/math/quat.cpp @@ -55,10 +55,13 @@ Vector3 Quat::get_euler_yxz() const { } void Quat::operator*=(const Quat &p_q) { - x = w * p_q.x + x * p_q.w + y * p_q.z - z * p_q.y; - y = w * p_q.y + y * p_q.w + z * p_q.x - x * p_q.z; - z = w * p_q.z + z * p_q.w + x * p_q.y - y * p_q.x; + real_t xx = w * p_q.x + x * p_q.w + y * p_q.z - z * p_q.y; + real_t yy = w * p_q.y + y * p_q.w + z * p_q.x - x * p_q.z; + real_t zz = w * p_q.z + z * p_q.w + x * p_q.y - y * p_q.x; w = w * p_q.w - x * p_q.x - y * p_q.y - z * p_q.z; + x = xx; + y = yy; + z = zz; } Quat Quat::operator*(const Quat &p_q) const { |