fixed Pingpong animation get snaging on the edge in AnimationTree

This commit is contained in:
Silc Renew 2022-06-29 08:29:01 +09:00
parent caa9ec8aca
commit 2201c281dd
1 changed files with 2 additions and 2 deletions

View File

@ -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 (anim->get_loop_mode() == Animation::LOOP_PINGPONG) {
if (!Math::is_zero_approx(anim_size)) { if (!Math::is_zero_approx(anim_size)) {
if ((int)Math::floor(abs(time - prev_time) / anim_size) % 2 == 0) { 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; backward = !backward;
pingponged = -1; pingponged = -1;
} }
if (prev_time < anim_size && time >= anim_size) { if (prev_time <= anim_size && time > anim_size) {
backward = !backward; backward = !backward;
pingponged = 1; pingponged = 1;
} }