diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-11-01 15:47:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-01 15:47:39 +0100 |
commit | 223e361c4ee2b12a174c75534ef2d2dec63ac024 (patch) | |
tree | f145660243594245942327fa43035ac7b25e86e4 /scene/animation | |
parent | efbaa4d366433deffd937cbb508e0d5e207306bc (diff) | |
parent | 826af5b28ad190345cf4daa076a8c552a101ce51 (diff) |
Merge pull request #42703 from RandomShaper/fix_anim_backwards
Fix premature end of animation playing backwards
Diffstat (limited to 'scene/animation')
-rw-r--r-- | scene/animation/animation_player.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 30757d2d80..4c869943e5 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -762,12 +762,10 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, f next_pos = len; } - // fix delta - delta = next_pos - cd.pos; + bool backwards = signbit(delta); // Negative zero means playing backwards too + delta = next_pos - cd.pos; // Fix delta (after determination of backwards because negative zero is lost here) if (&cd == &playback.current) { - bool backwards = delta < 0; - if (!backwards && cd.pos <= len && next_pos == len /*&& playback.blend.empty()*/) { //playback finished end_reached = true; |