Animation doesn't loop

Godot Version

3.5.2

Question

Hey all , im trying to make animation loop when pressing button but it do not
All ii have is very short loop animation
run

my running loop animation :

and the script that trigger the loop which is not working

extends KinematicBody


export(NodePath) var animationTree
onready var anim_tree = get_node(animationTree)


func _physics_process(delta):
	var root_motion : Transform = anim_tree.get_root_motion_transform() 
	var v = root_motion.origin / delta
	if Input.is_action_just_pressed("ui_select"):
	   anim_tree["parameters/playback"].travel("Running_inplace-loop")
	else:
	   anim_tree["parameters/playback"].travel("Breathing Idle-loop")
	
	move_and_slide(v,Vector3.UP)

when i click the running in the AnimationTree it dos loop
what am i doing wrong ?
Thanks

You are just traveling to the running animation the first frame ui_select is pressed. The next frame it will travel back to the idle animation. You’ll need to fix the logic in your script.

2 Likes