From 2201c281dd588cfed35864b191759c9e1e435691 Mon Sep 17 00:00:00 2001 From: Silc Renew Date: Wed, 29 Jun 2022 08:29:01 +0900 Subject: [PATCH] fixed Pingpong animation get snaging on the edge in AnimationTree --- scene/animation/animation_blend_tree.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index 1d537837bda..4f6975deb15 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; }