A* Pathfinding Project

AI has Path Completed without ever moving


#1

I recently got A*PP to replace my current pathfinding system which uses the Unity navmesh but I am getting some weird behavior. The first time I scan to generate a grid graph, everything works as expected. After I spawn a RichAI and set a destination, the graph changes tto only contain nodes with the AI path. Here’s the before and after:

I’m not sure if this is normal but regardless the real problem is that the AI never moves but I get Path Completed spammed in the console:

Path Completed : Computation Time 8.975 ms Searched Nodes 49 Path Length 17
Path Completed : Computation Time 0.000 ms Searched Nodes 49 Path Length 17
Path Completed : Computation Time 0.000 ms Searched Nodes 49 Path Length 17
Path Completed : Computation Time 0.000 ms Searched Nodes 49 Path Length 17
Path Completed : Computation Time 0.000 ms Searched Nodes 49 Path Length 17
Path Completed : Computation Time 0.000 ms Searched Nodes 49 Path Length 17

I’m not sure why it’s not moving. My settings seem good to me but maybe I am missing something. Here are my AStar and RichAI settings:


#2

Hi

Do you happen to have “A* inspector -> Settings -> Debug -> Show Search Tree” enabled? If that is enabled only the nodes that were searched by the last path will be shown in the scene view.
You can turn off logging in A* Inspector -> Settings -> Debug -> Path Logging.


#3

Ah yes thanks! I knew it was something like that.

Any idea what is causing the AI not moving and spamming Path Completed when it is clearly not at its destination? Alternatively, are there any debug tools that could help me figure that out?


#4

The “Path Completed” message is logged when the path calculation has been completed. The AI repeatedly recalculates its path (controlled by RichAI -> repathRate) and it logs that message each time.
Also. It looks like you are trying to use the RichAI movement script on a grid graph. The RichAI movement script is built for only navmesh based graphs. You might want to use the AIPath script instead. See https://arongranberg.com/astar/docs/movementscripts.html


#5

Ah well that would explain it. I hadn’t seen that movement scripts page. Very useful. Thanks :slight_smile: