Inconsistent Movement

Hey, I’m pretty new to A* Pathfinding. I bought version 3.x in 2016, but got too busy to do gamedev, so I haven’t actually started using it until just a few days ago. I’m having an issue with using it on simple 2D game. I’m just trying to make an object (an NPC) follow a target (the player) around x and y planes, but the movement isn’t consistent. The object will continually accelerate and decelerate, instead of moving at a continuous speed. You can see it in the attached GIF. The NPC with the helmet has pathfinding, and is chasing the player. The bigger NPC is also chasing the player, but without pathfinding, so it goes through walls; its movement is much smoother in comparison.

Here are the settings I’m using:

Any help would be appreciated.


I think this is due to the AILerp’s path interpolation together with some settings.

I would guess that your Seeker -> Start End Modifer -> Start Point setting is set to SnapToNode, is that correct?
What happens in that case is that every time the AILerp script calculates a path, it will snap the start point of the path to the center of the nearest node. When the path then has been calculated the start point will not be exactly where the unit is, so the AILerp script will try to smoothly move to the new path over a small amount of time (this is the ‘interpolate path switches’ setting). To solve this I would suggest setting Seeker -> Start End Modifier -> Start Point to ‘ClosestOnNode’ instead which will make the start point of the path line up much better with where the unit actually is.

I’m afraid that the Seeker settings were at their default, i.e. already on Closest On Node. I experimented with the other Start Point options, and the one that came the closest to smooth movement is Original. However, the NPC will still only move around in eight cardinal directions, instead of taking a beeline to the player.

Ok. I’m not sure what could cause that uneven velocity otherwise.

To make the AI move in a straight line to the target I recommend using the raycast modifier component.
Make sure you use graph raycasting for it (if you have the pro version). Otherwise download the beta because then it has support for 2D physics (I don’t think the latest non beta version of that component has support for 2D physics otherwise).

I think I found the solution. In the Seeker script, the Exact Start Point made a difference when I set it to Original. Here it is with a Simple Smooth modifier:

It’s pretty close to ideal! There’s just a weird little lag when chasing the player sometimes, when the object is very close to the player. It seems to be present no matter what the Exact End Point setting is, and becomes especially obvious if the NPC is faster than the player.

I also tried attaching a Raycast Modifier script — both with and without the Simple Smooth — and it returns this error:

InvalidOperationException: The operation is not possible when moved past all properties (Next returned false)

Huh. Maybe there was some bug in that 3.x version you are using that causes ClosestOnNode not to behave properly… On grid graphs it should be identical to ‘original’ except when the unit is outside the graph.

The exception might be due to some Unity API update. Are you sure you are using the latest 3.x version (can be downloaded from here:

The delay is likely due to the AI only recalculating its path at regular intervals. This is controlled by the ‘repath rate’ field. You can try reducing it to make the AI recalculate its path more often.

The repath rate helped.

I’ve been working with the latest version, which says that it’s version 3.8.12 on the site. In Unity, though, it says “New Version Available! 3.8.12”. I also got this warning in the inspector:

Trying to load data from an older version of the A* Pathfinding Project Current version: 3.8.10 Data version: 3.7.3

Not sure if that’s a bug, or if the wrong version was uploaded.

Either way, I appreciate the responses I’ve been getting. It’s nice to have prompt assistance from the developer.


Ah. I think that was due to a bug in my build script. It didn’t update the version number properly. If you downloaded it and it says 3.8.12 then it is 3.8.12 even though the scripts say 3.8.10.