From 3ebb58cd9ad196e82f354b379ca60a4d6fdd2806 Mon Sep 17 00:00:00 2001 From: Silc 'Tokage' Renew Date: Sun, 17 Oct 2021 09:07:10 +0900 Subject: [PATCH] Fix Anim Tree blending inconsistency Co-authored-by: Marios Staikopoulos marios@staik.net --- scene/animation/animation_tree.cpp | 12 +----------- scene/animation/animation_tree.h | 1 - 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index ccb5fa9472e3..f610fe337be0 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -934,7 +934,6 @@ void AnimationTree::_process_graph(real_t p_delta) { t->process_pass = process_pass; t->loc = Vector3(); t->rot = Quaternion(); - t->rot_blend_accum = 0; t->scale = Vector3(1, 1, 1); } @@ -995,7 +994,6 @@ void AnimationTree::_process_graph(real_t p_delta) { t->process_pass = process_pass; t->loc = Vector3(); t->rot = Quaternion(); - t->rot_blend_accum = 0; t->scale = Vector3(1, 1, 1); } @@ -1047,14 +1045,7 @@ void AnimationTree::_process_graph(real_t p_delta) { continue; } - if (t->rot_blend_accum == 0) { - t->rot = rot; - t->rot_blend_accum = blend; - } else { - real_t rot_total = t->rot_blend_accum + blend; - t->rot = rot.slerp(t->rot, t->rot_blend_accum / rot_total).normalized(); - t->rot_blend_accum = rot_total; - } + t->rot = (t->rot * Quaternion().slerp(rot, blend)).normalized(); } #endif // _3D_DISABLED } break; @@ -1066,7 +1057,6 @@ void AnimationTree::_process_graph(real_t p_delta) { t->process_pass = process_pass; t->loc = Vector3(); t->rot = Quaternion(); - t->rot_blend_accum = 0; t->scale = Vector3(1, 1, 1); } diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h index 21b49937a77a..1fa65fe76fb2 100644 --- a/scene/animation/animation_tree.h +++ b/scene/animation/animation_tree.h @@ -202,7 +202,6 @@ class AnimationTree : public Node { bool scale_used = false; Vector3 loc; Quaternion rot; - real_t rot_blend_accum = 0.0; Vector3 scale; TrackCacheTransform() {