AI - Character Movement always "moving"

Hello guys,

My problem is very weird. I’ve set up animations for enemy AI in the same way as I did to Player character.

As we can see, I have Variables for activating each animation state.

If character start moving he suppose to play Walk animation and he do.

When walking speed is bigger than 0 then Walk anim is on, so it is.

In Behavior Tree, I’ve set up how fast he suppose to move depends on what he actually doing. This is working but, he never stop walking. I print the value on screen what speed he has at the moment and its always on maximum, even when he stop. Speed Value is never going to 0 so animation is always on walking state.

I have no idea where the problem is. I’ve checked everything but still no results.

So, he walks near the player, then stop in specify range and attack but he’s speed is never going to 0.

Any ideas?

Instead of “Get Max Speed” try “Get Velocity” then a “Lenght” Node that should fix your problem

I can’t believe how easy that was. Everything is working now. Cheers!

This worked for me too, thank you very much