Topic was automatically imported from the old Question2Answer platform.
Asked By
rakmot
Hello, I am making a game and imported a rigged model from blender. It has multiple animations under one animation player node. I wanted to ask, how should I play each animation from that one node when I click a certain keyboard key?
Assuming you attach a script to the animationPlayer’s node
func _input(event):
if event is InputEventKey: #if a keyboard key is pressed
if event.is_pressed(): #if the key is pressed
if event.scancode == KEY_SPACE: #the space is pressed
play("name_of_first_animation")
elif event.scancode == KEY_C: #the c key is pressed
play("name_of_second_animation")
if you attach the scrip to a parent node then it will be $AnimationPlayer.play("myanimation")