+1 vote

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 ?

in Engine by (43 points)
reshown by

1 Answer

+1 vote
Best answer

oh mine, I've just change:

var trackAnimPath = "Head:frame"

Its working now...

by (43 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.