[3D] AnimationPlayer animation disregards animation length

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By RevampedSpider

I am making a 3D platformer game in Godot. To make the 3D movement, I followed Jayanam’s tutorial on a third-person controller. The problem is, after I add the animations to the script, the walk animation disregards the set length, so the character (animation-wise) walks, pauses, walks, and pauses endlessly. I haven’t found any issues that would cause this so far, so I decided to ask here.

The animation code is below:

var anim_to_play = "idle-loop"

if is_moving:
	anim_to_play = "walk"

var current_animation = anim_player.get_current_animation()
if current_animation != anim_to_play:
	anim_player.play(anim_to_play)

Link to the animation tutorial: