From a259112d6e358740b3cbfcfba52f81aad5a49863 Mon Sep 17 00:00:00 2001 From: Espeute Clement Date: Tue, 21 Apr 2020 18:47:25 +0200 Subject: [PATCH] Fixed Animation Playback Track not seeking properly Fixes #38093. (cherry picked from commit aa72af4f4631ddcb2cc35a5b5facde3a6737f981) --- scene/animation/animation_player.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index c428cf5dd28..8cec21e1e01 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -725,7 +725,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float if (anim->has_loop()) { at_anim_pos = Math::fposmod(p_time - pos, anim->get_length()); //seek to loop } else { - at_anim_pos = MAX(anim->get_length(), p_time - pos); //seek to end + at_anim_pos = MIN(anim->get_length(), p_time - pos); //seek to end } if (player->is_playing() || p_seeked) { @@ -753,6 +753,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float } } else { player->play(anim_name); + player->seek(0.0, true); nc->animation_playing = true; playing_caches.insert(nc); }