Why doesn't my AI reach its goal destination?

I’ve some AI that have a behavior tree. They run about picking different targets and use a “simple Move to location” to navigate to them. I have a raycast for debugging that draws a line from their location to their target move location. The moves can move them around 20,000 unreal units in both directions. The terrain is relatively simple. Just a few gentle hills. no crazy angles. After they have moved around for a moment they tend to get stuck. It generally happens around completing one full move to 4-5 moves. But eventually they just stop. I can see in the behavior tree that the move branch is firing. I can see the blackboard value reading “moving” and I can go frame by frame watching the behavior tree seeing that it is in fact firing the correct branch and they should be trying to finish their move. However based on all of their path traces that I trace draw. I can see they have just stopped mid-move and loop this branch of the behavior tree. Now I’m sure I can just throw in a condition that will jump start them when they breakdown but I’ve explored what preciously is causing this and I cannot figure it out. I’ve also tried using Move to location over the “simple” version and it also produces the same effect. Again, I can see by the traces that their targets are perfectly sitting on top of the nav mesh and they should just continue to walk towards their target. But they just stop after a few goes. It looks like they just run out of rope. Is there something about long moves that causes this to happen?

5125-smtex_a.jpg

alt text

Hey

I am looking into this issue. Could you post a screenshot of your Behavior Tree’s setup? Also a screenshot of your Task that gets the location will help.

Thanks!

I’ve taken this further now and created something to jump start them if they get stuck, unfortunately, they stay stuck. The example above is a simplified version. All that is happening is I’m swapping out a tag to move from one task to the next. Each decorator checks to make sure the tag says the name of the task. If it does then the task is executed. It’s pretty basic. To jump start them I created a service that checks every 3 seconds to see if the distance from their current location to the target is the same as it was 3 seconds ago. If so then I swap the tag from Moving (the task they are currently stuck on) back to Idle, which then gets a new target, and then checks to make sure that target is more than 100 units away, then it fires “Moving” again and they should start moving towards the new target. With the jump start they will occasionally come back to life and move towards their new target but, they will get stuck again and sometimes it will not be jump startable. Even though I can see the tag’s shuffle back to idle, and all the following tasks get executed. I can even see the trace to it’s new target update - yet it remains still.

Using just “Simple Move to Location” fixes the problem, but it’s not what I was trying to do. Using that move forces the pawn to immediately turn the direction of the new target and begin moving. So to counter this I have a point that sits out in front of the AI, it’s the forward vector and the right vector added together which produces a diagonal line out in front to the right. I then Dot product this to get the appropriate left or right diagonal and use VInterp to blend between the point out in front and the newly created diagonal point. This allows the character to move more smoothly. It appears that this VInterp is causing the problem, I’m guessing this is just my fault - some bug I’ll have to find.

I believe I have found the problem with this. Simple Move To Location must have built in “Pathfinding”, because when I switch that node for “Move to Location” and disable “use pathfinding” on the node my problem goes away. I’m guessing that by teathering the AI to a point out in front that blended either slightly to the left, or slightly to the right. I think it would square up with what the pathfinding was wanting to do and essentially lock or clamp as they opposed one another.

Hey

Sorry for the late response. I am glad to see that you discovered a solution. You are correct, the “Simple” Move To nodes in blueprints use pathfinding via navmesh. Would a “Move Directly Toward” task in the BT work better for you? It will ignore pathing for movement like the Move to Location. Let me know if there is anything else I can do to assist you.

Cheers!