Path keeps changing even when target is staying at one place

Hi Aron, i switched to AiPath from AiLerp since i needed some physics, but now i’m getting this issue:
Whenever i click i change target’s position and agent follows target, but even when target is not moving agent keeps changing path slightly everytime and it it looks laggy, is there any way to solve this?
Btw, i’m using grid graph and AiPath, Node size is 1 unit and start and end node snapping are set to Node Center(snap to node)path

With smooth modifier it’s a bit better but still movement is tugged.


It looks like you have changed the Seeker -> StartEndModifier -> Start Point to CenterOfNode. If you want smooth movement I would recommend ClosestOnNode. Otherwise the start of the path will not correspond to the agents current position.

don’t think that’s the issue, tried with closest on node, no big changes, here’s the setting’s that i’m using. Since i’m also visualing this path in game it get’s annoying otherwise i would leave it as it.


So what happens is the character recalculates its path while it is traversing it. Since it is sometimes inside nodes that were not strictly on the path (especially when traversing along a diagonal connection) then it may recalculate the path starting from a node which was not on the original path. The result may be a path which does not overlap completely with the original path.

You can solve this in a few different ways:

  1. Recalculate the path only on user actions. For example, when you click to set the target then you call ai.SearchPath(). Set ai.canSearch = false to prevent it from recalculating the path on its own.
  2. Use a modifier which removes most of the differences between the two paths. For example the RaycastModifier with physics raycasting disabled and graph raycasting enabled. This will make the paths much more straight to the target.