Godot Version
Godot 4.3
Animations do not play on Animation Tree Travel
The problem I am experiencing is that the animations for the 3D model aren’t triggering. The way the project has been set up, a change_anim signal is emitted to signal to other scripts that the animation is changing state, and ideally it should trigger simple code that tells the animation tree to travel to the state.
Sample code to show what I have implemented:
Animation Change Script:
extends Node
@onready var anim_tree = $"../AnimationTree"["parameters/playback"]
func _ready():
anim_tree.travel("Idle")
func _on_model_change_anim(state: String) -> void:
anim_tree.travel(state)
Enemy movement script:
signal change_anim(state: String)
func _ready() -> void:
#Set Idle animation
change_anim.emit("Idle")
func change_animation(state: String) -> void:
change_anim.emit(state)
func _on_navigation_agent_3d_target_reached() -> void:
print_debug("I made it!")
match Aggression_State:
Aggression.Aggressive:
# When they reach the player
# Grab the new player position
var player_position = player_target.global_position
# Check player position, if close enough then you can attack
if player_position.distance_to(global_position) < attack_margin:
change_animation("Attack")
# if not close enough then set new target position
else:
Nav_Agent.target_position = player_target.global_position
And here is the state tree for the model.
Everything looks sound. I been following this documentation. Yet the animations are not playing in the scene. So, I am not sure if there is anything I am missing or anything wrong with the logic.