AI Character stops playing Anim between two specific targetPoints

Hi there!

Been working on getting into making AI Characters that use Animation Blueprints.

My current AI now walks/runs between multiple targetPoints in an array that are chosen at random when the AI is supposed to move.

This has been working nicely so far. But I’ve recently noticed that the AI will stop playing its walking/running animation from one specific point to another. It’ll just slide across the ground/terrain in one direction between the two points, but work in the other direction.

Has anyone come across this?

The navmesh should be working just fine between the two points. I can’t see it being broken when viewing it in the editor. Also tried rebuilding the navmesh to no avail. Adding more targetPoints doesn’t seem to affect those two points specifically.

The animation Blueprint is set to play the Walk/Run animation when the velocity in the X or Y axis are larger than 0.
As the model moves, it does register that it should be walking/running without fail.

Your velocity check is only checking for positive numbers. Velocity will report speed in any direction so will be both positive and negative.

Also, when comparing floats, it’s better to assume it’s not going to be a perfect number like 600.0. Because of the nature of the float data type, you will often see actual numbers like 599.9999832, or 600.000134. Don’t be alarmed, it’s not an error, it’s a float. Instead of using ==, I try to use greater than or less than if I can. Often the Nearly Equal node can be used instead of ==, it is more robust when dealing with “equal” floats.

That solved it!

The float values were apparently in the negatives between those specific points.
Will never trust floats again!