Support Forum

Getting the AI towards the center of layered grid mesh

I am new to A* Pathfinding and still reading and trying to find tutorials. One thing I am being stuck at is I want my NPCs to go in the center of paths not cutting corners right on the red boxes and sometimes in them. I have tweaked some settings and at least have things playable but this walking through walls or clipping walls instead of the huge open path right beside these areas just looks bad. Suggestions of what variables, settings etc to set to force the NPCs to the center of paths. All of this level is inside a building so there isnt huge open areas, just rooms. Thanks


I’m not quite sure, but it sounds like you might want to adjust either the AI’s ‘pick next waypoint distance’ field, or adjust the grid graph’s diameter setting.

Ive done both of those and the pick next waypoint is at .75 and I reduced the grid down to qtrs I think. That at least made it playable but still the AI wants to cut corners. How about this AILerp? I was doing some reading on it. Is there a video on this? And am I heading in the right direction? Thanks.


AILerp will follow the given path exactly without any deviations. This is definitely what you want for some games.

You can read more about it here: Movement scripts - A* Pathfinding Project
and here AILerp - A* Pathfinding Project

I was able to solve my problem by switching from the grid graph to recast and use RichAI. Now they walk through the center of doors and stop trying to cut corners and get hung up on the walls.

1 Like