Skip to content

Commit

Permalink
Fix Anim Tree blending inconsistency
Browse files Browse the repository at this point in the history
Co-authored-by: Marios Staikopoulos marios@staik.net
  • Loading branch information
TokageItLab committed Oct 17, 2021
1 parent c2a616f commit 3ebb58c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
12 changes: 1 addition & 11 deletions scene/animation/animation_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down
1 change: 0 additions & 1 deletion scene/animation/animation_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 3ebb58c

Please sign in to comment.