Animation Tree travel problem: !p_state_machine->states.has(p_travel)" is true. Returned: false

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ilank

Hi, I’m adding an animation, and I get the following error when I try to travel to it.

E 0:00:06.798 _travel: Condition “!p_state_machine->states.has(p_travel)” is true. Returned: false
<Sorgente C++>scene/animation/animation_node_state_machine.cpp:184 @ _travel()

code:

state_machine.travel(“11_att_terra_dx”)
if state_machine.get_current_node() == “11_att_terra_dx”:
is_attacking = true

the is_attacking variable remains false.

I successfully added several animations already. This time I get this exception.
Can you help me?
Thanks!

:bust_in_silhouette: Reply From: Kanor

Hey! I recently got this error and scrounged around for a bit. I realized a few minutes later that I was dumb, and forgot to add the animation to the animation tree. Maybe it’s something similar for you? It’s possible the state is just missing or misspelled.

There is another problem though, that you’ll probably have to find a way around: Travel is not automatic. In fact, while a state machine is travelling, it takes a whole frame for the travelling to start, and if any animations between the states uses an at_end transition, you’ll be waiting quite a while. So you won’t be able to call get_current_node() immediately. I’d recommend using call_deferred(), or placing the if statement in the _process function so the is_atacking variable will be updated as soon as the travelling is done.