I'm using the AnimationTree state machine for animatiions. For some reason, the player's default idle animation won't play through when idling. It'll transition to the animation as far as I can tell, but again, won't play. Here's my code currently:

extends KinematicBody2D

#VARIABLES
export var walkSpeed: int;
export var runSpeed: int;
export var jumpForce: int;
export var gravity: int;
export var maxFallSpeed: int;
export var backslideSpeed: int;

export var health: int;

#CHECKS
var isCrouching: bool = false;
var isAttacking: bool = false;

var stateMachine;
var velocity: = Vector2();

func _ready():
	stateMachine = $AnimationTree.get("parameters/playback");

func _process(_delta):
	pass;

func input():
	var current = stateMachine.get_current_node();
	
#MOVEMENT
	if Input.is_action_pressed("right") and !isCrouching and !isAttacking:
		$Sprite.scale.x = 1;
		if Input.is_action_pressed("run"):
			velocity.x = runSpeed;
			if is_on_floor():
				stateMachine.travel("Run");
		else:
			velocity.x = walkSpeed;
			if is_on_floor():
				stateMachine.travel("Trot");
	elif Input.is_action_pressed("left") and !isCrouching and !isAttacking:
		$Sprite.scale.x = -1;
		if Input.is_action_pressed("run"):
			velocity.x = -runSpeed;
			if is_on_floor():
				stateMachine.travel("Run");
		else:
			velocity.x = -walkSpeed;
			if is_on_floor():
				stateMachine.travel("Trot");
	else:
		velocity.x = 0;
		# only play if not crouching
		if !isCrouching and is_on_floor():
			stateMachine.travel("Idle");

#JUMP
	if is_on_floor() and Input.is_action_pressed("jump") and !isAttacking:
		velocity.y = -jumpForce;
		stateMachine.travel("Jump");
		
#FALL
	if velocity.y >= 0 and !is_on_floor():
		stateMachine.travel("Fall");

#CROUCH
	if is_on_floor() and Input.is_action_pressed("crouch") and velocity.y == 0:
		isCrouching = true;
		$CrouchCollision.disabled = false;
		$BodyCollision.disabled = true;
		stateMachine.travel("Crouch");
	else:
		isCrouching = false;
		$CrouchCollision.disabled = true;
		$BodyCollision.disabled = false;

func _physics_process(delta):
	input();
	velocity.y += gravity * delta;
	if velocity.y > maxFallSpeed:
		velocity.y = maxFallSpeed;
	velocity = move_and_slide(velocity, Vector2.UP);

animationTree.active = true

@Zelta said: animationTree.active = true

Already set it to active in the inspector. The other animations are working, just not the idle, although it will play if down is held while the crouch code is commented out.

Edit: Also getting this error whenever it should be playing:

travel: Condition "!p_state_machine->states.has(p_travel)" is true. Returned: false <C++ Source> scene/animation/animation_node_state_machine.cpp:184 @ travel()

ah ok i thought the animation tree need set active in the ready func, my bad.

why not using the func Input(event)? maybe the input into the physics process are blocking your idle function in some way

@Zelta said: ah ok i thought the animation tree need set active in the ready func, my bad.

why not using the func Input(event)? maybe the input into the physics process are blocking your idle function in some way

I kinda doubt it considering it was working fine when I was using AnimationPlayer.play. AFAIK, it's getting to the idle state, just not playing the animation for some reason.

did u set autoplay on the animation tree?

@Zelta said: did u set autoplay on the animation tree?

I did, yes.

a month later

Old thread, but posting this here since I figured out what the issue was ages ago: a simple, rookie mistake of misspelling the name of the state itself. In my case, it should've been "IdleStand" instead of just "Idle."

a year later