Anyone aware of any sample source code that contain Navigational Meshes?
I'm aware of recast navigation (which is a little bit too complicated). - Written in C++.
Preferably C# but C++ is ok.
Anyone aware of any sample source code that contain Navigational Meshes?
I'm aware of recast navigation (which is a little bit too complicated). - Written in C++.
Preferably C# but C++ is ok.
I haven't really used Navigation Meshes extensively yet, but from your reply, since you're only looking at how to generate the nodes and traverse it, I would do it the following way.
Firstly, to generate the nodes in the navigation graph, I'd iterate through all the quads in the mesh and add them to a graph appropriately.
E.g.
foreach quad in mesh
{
add quad to graph
if quad has neighbouring quads
add neighbouring quads to the neighbour list of the added quad
}
That's a fairly simple brute-force method, but there's probably better methods out there.
To traverse the created graph simply make use of A* (A* Algorithm). This will give you a higher level path (a path from quad-to-quad).
Then to pathfind within each quad you can use a simple steering behaviours towards the next quad or even A* again to find the shortest-path (if you've got obstacles in the way).
Not sure if that's been explained very well, but it's a very high level look at it.
Hope it helps.
Ray