From 74e8d5c7bddbe261419f8e46db51a24b161fd9f1 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Wed, 10 Nov 2021 14:28:27 +0800 Subject: [PATCH] Fix AnimationTree function call track loop --- scene/animation/animation_blend_tree.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index 3fc749d8f63..dbfe7ac6fb6 100644 --- a/scene/animation/animation_blend_tree.cpp +++ b/scene/animation/animation_blend_tree.cpp @@ -67,7 +67,7 @@ float AnimationNodeAnimation::process(float p_time, bool p_seek) { AnimationPlayer *ap = state->player; ERR_FAIL_COND_V(!ap, 0); - float time = get_parameter(this->time); + const float current_time = get_parameter(this->time); if (!ap->has_animation(animation)) { AnimationNodeBlendTree *tree = Object::cast_to(parent); @@ -84,6 +84,7 @@ float AnimationNodeAnimation::process(float p_time, bool p_seek) { Ref anim = ap->get_animation(animation); + float time = current_time; float step; if (p_seek) { @@ -103,6 +104,7 @@ float AnimationNodeAnimation::process(float p_time, bool p_seek) { } else if (time > anim_size) { time = anim_size; + step = anim_size - current_time; } blend_animation(animation, time, step, p_seek, 1.0);