AI travel distance to point

I have an AI that will calculate points around himself in a radius to move to.
This works great, but If the closest point is on the other side of a wall the distance that the AI has to walk to reach the point may actually be the farthest of all the points.

Is there a way to find the actual distance the AI has to walk to reach a point?
EpEp

This should do it:

Are you familiar with pathfinding algorithms such as A* or Djikstra?

Thanks Vesros, Il give that a try.
I have a very basic understanding of how A* and Djikstra work, but no in depth knowledge of the algorithm.

I’m using dynamic invokers and when I need my AI’s to get to a point outside their small generated nav mesh radius, I use EQS to get them to walk to the edge of their navmesh and towards the point, which then generates a new mesh closer and I repeat that until the AI has reached its point.

However, in cases like you mention, where something large blocks the route and the AI thinks it’s as close to the object as it can, I generally use “temporary” target points around my map.

It’s probably not the smartest or most efficient way, but the way I do it is I have volumes covering my areas and a target point somewhere between them.

I apologize for this terrible drawing

but basically, imagine the black box is a wall, the orange person is an AI, the green circle is the generated nav mesh, the blue circle is the destination point, the red circle is my temporary point and the light blue rectangles are 2 different volume boxes.

So in this case, the AI would want to go to the blue dot, however since it’s in the lower volume box, it’ll know it should go towards my red point first, and then it can continue its way to the blue dot.

Again, it’s probably a dumb way but it works. It’ll require some manually placed target points and volumes as well as some extra logic where the AI will seek the “exit points” in their current area. It also kind of forces you to design your level in a way where this is possible. Something like this would make it a bit more work and/or even require more temporary target points, or even checking the nearest one through some trace or whatever.

I hope someone mentions a easier, cleaner, and smarter way since I’m terrible at this stuff.

Then again… I might be completely misunderstanding your post and in that case, just ignore me :slight_smile: I’m a bit tired.

In my current situation I have a navmesh on the entire map and just want to find the distance of the calculated path.
But I have been thinking about how to handle moving outside a dynamically invoked navmesh.