I need help with imported animations

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: 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?

:bust_in_silhouette: Reply From: Wakatta

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
			elif event.scancode == KEY_C: #the c key is pressed

if you attach the scrip to a parent node then it will be $AnimationPlayer.play("myanimation")