Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Victoralm |
Inside my char (KinematicBody2D), I’ve an AnimationPlayer and I want to get the index of a track of the animation:
KinematicBody2D
AnimationPlayer
The script is on the KinematicBody2D like follows:
...
onready var animMove = $AnimMove # This is the AnimationPlayer
func _physics_process(delta):
var trackAnimPath = "AnimMove/Head:frame"
var startAnim = animMove.get_animation("walk_down")
var animIdx = startAnim.find_track(trackAnimPath)
print("animIdx: " + str(animIdx))
...
Then unfortunately to me, its returning: animIdx: -1
Please, what is the correct way to do it ?