Skip to content

Commit 3ebb58c

Browse files
committed
Fix Anim Tree blending inconsistency
Co-authored-by: Marios Staikopoulos marios@staik.net
1 parent c2a616f commit 3ebb58c

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

scene/animation/animation_tree.cpp

+1-11
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,6 @@ void AnimationTree::_process_graph(real_t p_delta) {
934934
t->process_pass = process_pass;
935935
t->loc = Vector3();
936936
t->rot = Quaternion();
937-
t->rot_blend_accum = 0;
938937
t->scale = Vector3(1, 1, 1);
939938
}
940939

@@ -995,7 +994,6 @@ void AnimationTree::_process_graph(real_t p_delta) {
995994
t->process_pass = process_pass;
996995
t->loc = Vector3();
997996
t->rot = Quaternion();
998-
t->rot_blend_accum = 0;
999997
t->scale = Vector3(1, 1, 1);
1000998
}
1001999

@@ -1047,14 +1045,7 @@ void AnimationTree::_process_graph(real_t p_delta) {
10471045
continue;
10481046
}
10491047

1050-
if (t->rot_blend_accum == 0) {
1051-
t->rot = rot;
1052-
t->rot_blend_accum = blend;
1053-
} else {
1054-
real_t rot_total = t->rot_blend_accum + blend;
1055-
t->rot = rot.slerp(t->rot, t->rot_blend_accum / rot_total).normalized();
1056-
t->rot_blend_accum = rot_total;
1057-
}
1048+
t->rot = (t->rot * Quaternion().slerp(rot, blend)).normalized();
10581049
}
10591050
#endif // _3D_DISABLED
10601051
} break;
@@ -1066,7 +1057,6 @@ void AnimationTree::_process_graph(real_t p_delta) {
10661057
t->process_pass = process_pass;
10671058
t->loc = Vector3();
10681059
t->rot = Quaternion();
1069-
t->rot_blend_accum = 0;
10701060
t->scale = Vector3(1, 1, 1);
10711061
}
10721062

scene/animation/animation_tree.h

-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ class AnimationTree : public Node {
202202
bool scale_used = false;
203203
Vector3 loc;
204204
Quaternion rot;
205-
real_t rot_blend_accum = 0.0;
206205
Vector3 scale;
207206

208207
TrackCacheTransform() {

0 commit comments

Comments
 (0)