Agent jumps/teleports when new path is assigned


I’ve got an A* character using the AILerp movement script along with funnel and raycast modifiers to improve path smoothness.

I’m experiencing issues whereby when I set a new path, the character sometimes jumps/teleports a small way to a different location before beginning his movement along the new path. I’ve recorded a demo of the issue, and I’m able to fairly consistently replicate the issue by clicking two times in quick succession to show you the kind of jankiness i’m experiencing, though I can also experience the issues when my character is standing still after having already walked a full path and I’ve assigned him just a single new path.

(How do I embed the video properly?)

How can I stop the character following the old path once the new path has been assigned (you can see him jump back and forth along the two paths for a second), and how can I ensure the character always sets off from the right location? As I said, it can also happen when he’s already reached his prior destination, meaning that perhaps it’s calculating the starting position incorrectly? Or some weird interpolation is causing the physical character to be in a slightly different end position to where the pathing system thinks he is!? (I’ve removed collider and rigid body in case they were causing issues, but still experiencing weird issues).

private void SyncPath_OnChange(List<Vector3> prev, List<Vector3> next, bool asServer)

private void OnPathComplete(Path path)
    if (!path.error)
        // Path didn't fail, so sync
        syncPath.Value = path.vectorPath;

/// <summary>
/// Receives the click point vector on the server and calculates the path.
/// </summary>
[ServerRpc(RunLocally = false, RequireOwnership = true)]
private void RpcMove(Vector3 destination)
    seeker.StartPath(ai.GetFeetPosition(), destination);

This is the code. I’m called RpcMove with the new destination, it uses a seeker to calculate the position on the server instance, before sending the calculated path back to the player.