From 3a439a9c0378d0c6f7d8ce67084863abbe4e87bc Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Mon, 28 Feb 2022 16:00:45 +0800 Subject: Fix AnimatedSprite infinite loop --- scene/3d/sprite_3d.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'scene/3d/sprite_3d.cpp') diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index b9fb3e9287..ce281c79bc 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -1019,14 +1019,14 @@ void AnimatedSprite3D::_notification(int p_what) { return; } - float speed = frames->get_animation_speed(animation); - if (speed == 0) { - return; //do nothing - } - double remaining = get_process_delta_time(); while (remaining) { + double speed = frames->get_animation_speed(animation); + if (speed == 0) { + return; // Do nothing. + } + if (timeout <= 0) { timeout = 1.0 / speed; -- cgit v1.2.3