FollowerEntity randomly rotates/jitters on the spot

Hey, thanks for looking at it. I’ve just tested it with a node size of 1, and that seems to fix it. However, in my project, I need a node size of 0.333.

So it seems to be the combination of small node size and high timescale.

Sorry I’m still reading, just haven’t responded. I don’t really have time right now to try swapping back to a FollowerEntity, but I too use a small node size (in fact, I’m on 0.05). That’s unfortunately not something I can increase as it would drastically impact our gameplay.

Our timescale is set to 1 though, but it does get worse if you increase the timescale. I recall reading somewhere in the docs that that’s probably due to the simulation having to catch up or something.

Do you two mind sharing your need for a smaller node sizes? There may be a workaround for what you’re both trying to achieve.

In our case we only use dynamically generated navmeshes, as the player is in full control of placement of pretty much everything. We don’t align furniture on a grid so we need a smaller grid size to make sure that you don’t block off to much when rotating stuff (see image for an example). We also ported over a ton of assets from the original so we were stuck with the size of things.

We used to use the Unity navmesh for this, but ran into a lot of edge cases that were pretty much impossible to solve. We specifically opted for a grid to make it easier to find and solve these type of issues.

We’ve been playtesting for a few weeks now and the AIPath is working flawlessly so far.

image

We have a grid based building system where one cell has the size of 1x1. If we had a larger pathfinding grid size, there would be no pathfinding collision for the whole door which causes people to walk at the edge of the door, half through the wall, but we want them to be walking in the middle of the door.

It’s not possible for us to change the size of the buildable objects, as our whole system is already based on it.

I was going to suggest the Recast Graph in this case then, but if AIPath is working for you, that’s totally fine :slight_smile:

For this though, I am going to suggest looking at a Recast Graph. If there’s anything preventing you from using it let definitely let me know, but I think in this case you can get a little “have your cake and eat it too” from a Recast Graph.

I unfortunately can’t use a Recast Graph, because I need tags and penalties.

You can actually get tags working with Recast Graphs-- the general idea is to use NavmeshCut with “Is Dual” set to true, which will just make a new seem rather than remove the geometry altogether. Then you apply your penalty and tags. Midway down this page is a section detailing more of this.

Is it also working to update it in runtime? I have a grid based building system where the player builds up rooms and streets in the game. Therefore I already have a script that’s updating areas of the grid graph once something was built or demolished.

Since this is working really well already, I would honestly prefer to stay with the Grid Graph. Is it planned to fix the bug with the lower node size? I’m sure that other customers will have the same issue in the future.

The Navmesh Cut solution should be fine during runtime.

I wouldn’t call it much of a bug personally but that’s a per person line to draw. My logic, is that if set your agent’s move speed to 40,000 and it doesn’t work well…that’s not much of a bug it’s moreso just outside of the design of the program.

I’d probably tell other folks the same thing though, as well. Not that anyone who has this issue is in the wrong somehow, but rather that there are ways around this already.

Alternatively, those who are down with getting their hands dirty with some code editing can modify the FollowerEntity to accomodate this edge case, or simply make a custom movement script to have their cake (Grid Graph) and eat it too (Small Grid Size).

I appreciate your perspective, but I believe the issue extends beyond being merely outside the intended design. The behavior occurs even with node sizes slightly below 1, which are common in games requiring finer navigation precision. If this behavior only manifested with extremely small node sizes, I would agree it falls outside the expected use case.

I would be grateful if you could consider investigating whether the current implementation can be adjusted to handle smaller node sizes more gracefully. Alternatively, providing clearer documentation on its limitations would be greatly appreciated. The current documentation (FollowerEntity - A* Pathfinding Project) mentions that it works well with a timescale greater than 1 but doesn’t specify any restrictions regarding node sizes below 1.

I could be 100% wrong with this too :slight_smile: This could in fact be a bug, or something @aron_granberg may want to address in a future update. So I’ll tag him on this and we can get his perspective on it as well. Regardless, hearing other folks input on this kind of stuff is always useful so thanks for providing it.

1 Like

Thank you! Is there any news about this yet? :slight_smile:

Nothing from Aron yet- I’d consider some of the alternatives posted above for the time being. There’s no guarantee this will be changed after all.

Hi

What you could try is to edit the PathTracer.cs file, search for this line:

const int MaxSimplifications = 3;

and replace that with, for example:

const int MaxSimplifications = 10;

That should make it handle very small node sizes much better. Though I would recommend that if you need that small node sizes (compared to your agent size), then a recast graph might be a better option.

Hi Aron,

Thanks for the reply. I’ve tried it with MaxSimplifications set to 10, but it unfortunately didn’t make any difference.

Hi, I’m running into this “rotating/jittering on the spot” issue as well.

I’m using FollowerEntity and RecastGraph and the issue happens very consistently with my current setup (Unity 6000.0.49f1 and A* Pathfinding Project 5.3.7).

Basically the path is found fine, but when the FollowerEntity starts moving, it will quickly stop and start doing the jittery rotation left and right (in relation to Z-forward) - then shortly after it continues moving on the path normally.

I found out that by disabling “Allow Rotating On The Spot” on the FollowerEntity will stop this problem from happening. At least I haven’t encountered it again yet. Hopefully that would help to debug the issue.

Hi

For grid graphs, I’ll include a few fixes related to this in the next beta version update. Let me know how that works for you. The next beta is likely to be released next week, or the week after that.

For recast graphs, I haven’t been able to replicate this, but there are a few changes that could improve it for recast graphs too.

1 Like

Hi Aron,

Great to hear, thank you very much! I’ll try it out once the update is available.