From e92e139302f2a521ad9d1ebafe1530f0cf80b60e Mon Sep 17 00:00:00 2001 From: chocola-mint <56677134+chocola-mint@users.noreply.github.com> Date: Sun, 12 Oct 2025 01:10:02 +0900 Subject: [PATCH] Seek to beginning of section if current playback position is after its end --- scene/animation/animation_player.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index d00ef800da..68d4b8450f 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -505,10 +505,10 @@ void AnimationPlayer::play_section(const StringName &p_name, double p_start_time c.assigned = name; emit_signal(SNAME("current_animation_changed"), c.assigned); } else { - if (p_from_end && Math::is_equal_approx(c.current.pos, start)) { + if (p_from_end && Animation::is_less_or_equal_approx(c.current.pos, start)) { // Animation reset but played backwards, set position to the end. seek_internal(end, true, true, true); - } else if (!p_from_end && Math::is_equal_approx(c.current.pos, end)) { + } else if (!p_from_end && Animation::is_greater_or_equal_approx(c.current.pos, end)) { // Animation resumed but already ended, set position to the beginning. seek_internal(start, true, true, true); } else if (playing) {