Support Forum

How to get nodes within a radius of a point on a navmesh graph?

Hi. I’m new to using A* and and it’s suiting all my needs so far. I am currently trying to make the AI on a Navmesh avoid a player and give them a wide distance around the player while moving to a certain destination. The way I figure to do this is to increase the penalty of the node that the player is on. The only issue is that when the player is on a very small triangle on the graph then I need to be able to get multiple nodes (and not necessarily the nodes connected to the center one but it could also be some of the nodes connected to those).

Is there a function for either getting multiple nodes around a certain point? Or nodes that intersect with a sphere collider? If there isn’t are there any tips on how I can most efficiently implement this feature?

Hi

You might be interested in ConstantPath - A* Pathfinding Project or PathUtilities - A* Pathfinding Project. However the distance functions they use are not very accurate on navmesh graphs (the constant path just uses the distance between the node centers). So you may want to filter the list afterwards.