Hey guys. I am trying to create a little Space Shooter. I wanted to use Unity’s built-in NavMeshAgent, but the problem is that it needs a NavMesh. And I don’t know how, or if you can create a 3 dimensional NavMesh. Is there any way I can make the Spaceships navigate in x, y and z? Or do I need an invisible layer in order to make the NavMeshAgent work?
Nav meshes work in 3D space, but the surfaces of the mesh are really 2D. or 2.5-D they can follow stairs and slopes up and down, and go over and under itself… but doesn’t lend itself well to a truly 3d space.
Depending on your level (space) layout… I would suggest that you’d want a node based system instead… more like a 3d cube of node points… each point in space would be free or not-useable (inside solid object) then at each node you’d do a bunch of ray casts, to nearby nodes to build a tree. Then you could use modified A* search algorithm to find path to follow in arbitrary 3d space.
You could also choose to make a tree where the nodes your raycast, are also further than just the nearest nodes, it would take longer to prepare your tree, but get better results.
If your map is simple… you could probably place the nodes and link them by hand, and make a simple tool to connect nodes, visualizing them using OnDrawGizmos()
For A*, you could write it yourself, or buy one on asset store that comes with source code, and modify it a bit for 3d support.