2D Player Movement Bug - speeding up on mutiple clicks

My player movement works fine if I wait until he reached the destination to then, send it to another 0:00 - 0:07 on the video:

But when I do multiple clicks, he “speed up” and make a strange effect on screen (0:08 - 0:015 on the video)

I’m calling the function UpdateTargetPosition(); of TargetMover script on Input.GetMouseButtonDown(0). Even with double click pattern this happens.

I tried to debug many things on AiLerp script but didn’t find the solution.

Please help


What are your Seeker -> Start End Modifier settings?

1 Like

Both Node Center:

Okay. I would recommend that you set Start Point Snapping to Node Connection (also explained here: https://arongranberg.com/astar/docs/ailerp.html). What happens right now is that if the AILerp script tries to calculate a new path when it is in between two nodes, the start point will be snapped to either the node center it came from or the one it is moving too, either way it introduces a discontinuity when following the path. It will smooth out that discontinuity (controlled by ‘Interpolate Path Switches’) however it will look like it is either speeding up or slowing down for a short duration.

1 Like

Thank you Aron!

Now I figure out, End Point with Node Center and Start Point with Node Connection works perfectly!

You are mading an excellent job with this asset, I’m so grateful to you!

I’m sorry for the title of post saying “bug”, there is no one.

Thank you!

1 Like

Thank you for the kind words! :slight_smile:
If you feel like supporting the asset even more, a rating or a review in the Unity Asset Store goes a long way :slight_smile:

1 Like

I definitely will!

Just one more thing

With this setup, I’m facing a strange behavior at the start of the path some times when I change the direction.

You see that at the beginning the player done an “unecessary” movement.

Can I do something to avoid that?


You could use the ‘Closest On Node’ setting for ‘Start Point Snapping’ instead. I think that will do what you want. With the ‘Node Connection’ mode it will always move along node connections, so that detour is necessary.

If you want smoother movement you could use for example a raycast modifier. See this page https://arongranberg.com/astar/docs/ailerp.html and this page for more info: https://arongranberg.com/astar/docs/modifiers2.html
(or just use the AIPath movement script which generally follows the path in a smoother way)

1 Like

Yeah, ‘Closest On Node’ did the trick.

I’m sorry I thought I tested it,

Thank you again!

1 Like