FollowerEntity randomly rotates/jitters on the spot

  • A* version: 5.3.3
  • Unity version: 2022.3.40f1

FollowerEntity pathfinding is behaving very inconsistently for us. Most of the time it works fine, but there’s seemingly random times (i’d say about 5-10% of the time?) when the agent suddenly does a little twirl on the spot. It happens mostly on corners (as seen in the gif) but sometimes also on when it’s moving in a straight line.

See example here: https://www.dropbox.com/scl/fi/iknanbfupw8wpe72o1zpq/pathfinding.gif?rlkey=kw80jy1g9jyomslrkr1as70dn&dl=1

We’re using a Grid Graph, which is static when these agents start moving about. Their destination is assigned once and doesn’t change until the agent has made it to its destination, there’s no local avoidance either so it’s fair to assume that it calculates a path and then stays on that path until it makes it there.

Here’s the settings I’m using:


To set the path, i use the following code:

_followerEntity.destination = target;
_followerEntity.SearchPath();

Things I’ve tried so far:
Messing with FollowerEntity radius, desiredwalldistance, stop distance, lead in radius, allow rotating on the spot, wall distance.
And on the grid graph: Cut Corners on/off, Changing the Collision testing Diameter.

The only thing that gave a noticeable improvement in the pathfinding was settings the thread count to “automatic high load”. That reduced the stuttering at least. Anyone got any ideas?

Can you record a gif of them walking along their path but with the gizmo showing their path visible?

Here’s a video with the Movement Debug Rendering set to Path.I tried reproducing this with only 1 agent walking but after an hour I had not come across it once. Only difference here is that I disabled the animations to reduce clutter.

https://www.dropbox.com/scl/fi/zdwvwzndy7wwy34xwuk5h/jiggle.mp4?rlkey=nqqgs5hrd41vuy0dxpkwydf13&dl=0

There’s 2 inconsistencies to be seen:

At the bottom of the screen, all the agents walk to the same spot (the middel of the blue circle) first, after that the next point is set (to the right, through the maze). Some of the agents walk in a nice curve, some start their curve and then halfway through it go straight for the next target and some do a jiggle there. EDIT: I guess this can be attributed to the path not being calculated yet sometimes.

At 0:23 you can see the first jiggle just top right of the red square.

I couldn’t get a capture of it now, but they also generally mess up just in front of the red object while moving up.

Another note: if I use AIPath instead of FollowerEntity it works just fine. Exact same test case, exact same code & parameters used (where applicable).

Hmm, pretty difficult one-- I’ve been bouncing back and forth between the video and Unity. Can you disable ‘Allow Rotating On The Spot’? Not sure if that’ll give you the moment you want but I’d like to see if that stops the spinning first.

That was one of the things I tried initially and did not fix it unfortunately.

I’ve gone back to AIPath for now because we’re on a bit of a deadline this week, with the Simple Smooth & Funnel modifiers it’s somewhat close to FollowerEntity (although FollowerEntity creates nicer looking paths imo). I’m not strapped for performance (yet) so I’m content leaving it as-is for now, but I’d love to swap back to FollowerEntity to free up the performance before we ship.

Not a problem :slight_smile: When you’re ready to try FollowerEntity again just let us know :+1:

Hey, I’m currently having the exact same problem with FollowerEntity. I’m using Unity 6000.0.42f1 and also A* 5.3.3.

Is there anything I can try to solve the issue?

Hmmm, go ahead and post your agent settings and I’ll see if I can find something :+1: