Create Path from vector points

Hey there.
This might be asked before but i couldn’t find any related topic so excuse a possible duplicate.

Plain and simple:
Is it possible to create a path (i’m using a recast graph) from a list of vector points? I would like to use IsPathPossible subsequently.

Thanks in advance,
Grille

I’m not quite sure what you mean. What would you want to accomplish with this?

Hey Aron,
thanks for asking!

We are developing a client-server game. For unit movement, i use the pathfinding on the client to create/find paths, sending the vectorPath to the server. After some server-side validation, the server sends a (maybe adjusted) vectorPath back to the client. Here i interpolate over the path without using pathfinding modules, like the seeker or else.
We really like the approach so far, especially the separation of client requests and server response comes with several advantages. It also means that the client does not keep track which request (aka pathfinding path) a vectorPath response is related to.

I’m using mesh cutter for dynamic objects and, while the client is interpolating over the vectorPath given by the server, i want to check if the path is still ‘valid’ (no objects came in its way) on a regular basis . Otherwise the client can search for an alternative route, sending it to the server and so forth…

My first approach was to do simple collision testing for all remaining segments of the vectorPath. I thought it could be possible as well to create a path from the vectorPath once and simply use IsPathPossible subsequently to check if the path got blocked by moving obstacles.

I see.

For a grid graph, this wouldn’t be so hard, however you seem to be using a recast graph and it is a bit trickier there. I assume you are using the funnel modifier. What I do for the RichAI script is to store the nodes that make up the path and if a node a short distance in front of the character has been destroyed (node.Destroyed) then it forces a path recalculation. When a navmesh cut modifies the navmesh it will destroy all nodes in that tile and new ones will be created (which may be in different positions due to the cut). Another approach would be to check if the distance between AstarPath.GetNearest(point).clampedPosition and point is very small for a few points along the path. This might miss very thin obstacles, but if you know what the minimum size would be in your game this could be a reasonable approach and would be relatively performant. Essentially this checks if the closest point on the navmesh is very close to the path (you should probably just check the distance along the X and Z coordinates though). The threshold distance should in a perfect world be zero, but due to floating point errors you should likely use something like 0.01 or similar. You shouldn’t use RecastGraph.PointOnNavmesh since when using the funnel modifier the path will go along the edge of the graph and thus PointOnNavmesh may return a node or it may not due to floating point errors.

Yes, i’m using a recast graph with funnel modifier. Your second approach sounds promising, i will try it out tomorrow!

Thanks for your quick reply, thoughts and your awesome work!