Animation Tree Won't Travel

Godot Version

4.3.stable

Question

I have an enemy with a few basic animations.
idle (loops), walk (loops), attack, death, etc.
I tell it to travel to one of the different node tree states with “travel()” and it doesn’t work.
I set up all my travels in the animation tree node state machine and have no typos.
I was able to get everything to work, just not as i would hope. Explained below.

This code works, it’s just I do not want to have an ever growing nest of boolians for each travel and timers to reset them in the calls that make them true.

This looks more how I’d like it. And based on how my anim tree is set up, if i travel to something like death it can never return to the idle, walk, etc. But it seems to either not even travel to death or possibly instantly go back to idle, walk.

Also, this seems related: Github: Animation travel not working when an animation is looped

In the code that is not working, did you check if the code is entering in the desired state? You can use print statements and make sure you are entering in the states. I noticed that you have a method written without the prefix “_” and all the others have. Isn’t this a mistype?

Since you have a condition property have you tried to use the condition to trigger the traversal?

$AnimationTree["parameters/conditions/death_1"] = true

Tried them. Don’t seem to do anything. I toggled them in both the remote and local view of the anim tree node.

I tried doing a print on the line after that prints current_anim
which is (current_anim = state_machine.get_current_node().get_basename())
so i can see whats the current node, but it never leaves walk or idle.
And the “_” doesn’t change anything at the moment, i will use data from my “Attack” class later on.

@pennyloafers @supernovafiles I just seen this video How to Use AnimationTree in Godot 4.2+ in 12 Minutes and he seems to experience the same logic problem as me. So it would seem that in me using a bunch of variables is not the wrong way to do it.

I’m working on a animated character with looping animations, and I haven’t run into a traversal problem.

Although the one thing I use is the expression option over defining an internal condition. This to me is easier to utilize the expression node with code and have the animation_tree do it’s thing in response to the character expressions. As changing state via animation_tree.get("big/string") is very tedious.

I will say your case is strange as calling traversal should instantly move to that animation. And your connections do not have a way back to an undead state. I’m wondering if the problem is somewhere else, maybe the animation? You do have a bunch of warnings in some of your images. Do any of the warnings relate to the problem area?

@pennyloafers I’ll look into using expressions, seems like it might be useful.
No errors or warnings as far as I can tell.
I’ve never had the issue with calling travel before in 4.2, I will open a blank 4.3 project and try making a basic tree/player combo with code to call travel.

@pennyloafers @supernovafiles I seem to have gotten it working. even though when it travels from say idle to attack and attack waits to auto travel back when finished, somehow because travel to idle is always being called it blocks the travel to attack.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.