I’m making a 3D game, and I’m gonna add NPCs which will need path finding. I know how to do this in 2D, but how do you do it in 3D?
I thought about making a 2D map and calculate paths using that, but is there a better way?
There’s a navigation mesh plugin available, if you search forums for “navmesh” or “navigation mesh” or something like that you’ll find it.
Also if you use a terrain that means the npcs are bound to a 2d surface, so 2d grid should work well.
Someone else knows this stuff better then me tho.
before i made 3d grid based pathfinding:
http://code.google.com/p/easyfinding/
just wanted to inform, because maybe someone need simply 3d pathfinding.
need some fixes but it work. actually i do not update it, because i will propably make my own graph based pathfinding(to learn this method) or using navimesh.
it is only good(not best) for grid based(even 3d grid) games. like fallout 1/2 or heroes.(only)
in other cases navimesh is best like androlo said. its graph as i good know, so it is much faster…
Thanks, will look into it.
This post looks promising for path finding. It uses nodes which could easily be adapted to 3D space.
I’ve also found quite a few supplementary articles on these algorithms from a Google search and there are videos on YouTube too.
As far as I know now, you got 2 ways to do it: either with gateway nodes or with navigation meshes. Gateway nodes is easier to make, but it lets NPCs zigzag. I have no idea how navigation meshes work, I know that they give information about what is walkable and what is not, but how can you determine it’s best path? By raycasting? Don’t you have to casts a ray into every direction and for every ‘block’ you walk then?