From 7adfba5746ad46dc51835feacd86763c9020d751 Mon Sep 17 00:00:00 2001 From: BruceCong Date: Thu, 21 Mar 2024 16:58:11 +0800 Subject: [PATCH] Fix Animation Playback Track not seeking properly Reapply bugfix https://github.com/godotengine/godot/pull/38107 --- scene/animation/animation_mixer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp index 7080a5338bce..877aeeeb7e3b 100644 --- a/scene/animation/animation_mixer.cpp +++ b/scene/animation/animation_mixer.cpp @@ -1623,7 +1623,7 @@ void AnimationMixer::_blend_process(double p_delta, bool p_update_only) { double at_anim_pos = 0.0; switch (anim->get_loop_mode()) { case Animation::LOOP_NONE: { - at_anim_pos = MAX((double)anim->get_length(), time - pos); //seek to end + at_anim_pos = MIN((double)anim->get_length(), time - pos); //seek to end } break; case Animation::LOOP_LINEAR: { at_anim_pos = Math::fposmod(time - pos, (double)anim->get_length()); //seek to loop @@ -1658,6 +1658,7 @@ void AnimationMixer::_blend_process(double p_delta, bool p_update_only) { } } else { player2->play(anim_name); + player2->seek(0.0, true); t->playing = true; playing_caches.insert(t); }