summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-06-29 10:13:30 +0200
committerGitHub <noreply@github.com>2022-06-29 10:13:30 +0200
commit90bed51d1c7855338dabac8f29ea7cbcbf2f1e4b (patch)
treec90740f6aa9bae5f30cb63ec99e2bc69238a06b4 /scene
parentcaa9ec8aca80e34944f2f725dd39f154007d3f77 (diff)
parent2201c281dd588cfed35864b191759c9e1e435691 (diff)
Merge pull request #62502 from TokageItLab/fix-pingpong-snag
Fixed pingpong animation get snaging on the edge in AnimationTree
Diffstat (limited to 'scene')
-rw-r--r--scene/animation/animation_blend_tree.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index 1d537837bd..4f6975deb1 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -104,11 +104,11 @@ double AnimationNodeAnimation::process(double p_time, bool p_seek, bool p_seek_r
if (anim->get_loop_mode() == Animation::LOOP_PINGPONG) {
if (!Math::is_zero_approx(anim_size)) {
if ((int)Math::floor(abs(time - prev_time) / anim_size) % 2 == 0) {
- if (prev_time > 0 && time <= 0) {
+ if (prev_time >= 0 && time < 0) {
backward = !backward;
pingponged = -1;
}
- if (prev_time < anim_size && time >= anim_size) {
+ if (prev_time <= anim_size && time > anim_size) {
backward = !backward;
pingponged = 1;
}