Which path-finding approach should I go with for a 3D grid map?

I’m currently working on a dungeon crawler game based on the old school grid system. Think of Dungeon Master or the more recent Legend of Grimrock.

I’m trying to figure out which approach should I go with, to implement a decent path-finding system. What is puzzling me is that, since the game’s map is hand crafted, I don’t actually have “map” object holding the locations of all walls and paths. Instead, the scene is made of 3D cudes. So, I have a few questions:

1 - Do I need need to have an array like object to hold all the positions of these 3D cubes? If so, would this be done by looping through all gameObjects to collect their positions and types (walkable, obstacle), at run time?

2 - Is it possible to have a Navigation Mesh work with grids? The Navigation Mesh system is really easy to use but I’m not sure how to make it work with nodes (tiles).

I’m new to unity. Perhaps there an easier approach to implement what I describe. I’ve looked into Unit’s assets but I don’t wont to buy anything without make sure it fits my needs. I need more knowledge on how this should be implemented before I can decide anything.

Thank you for any feedback.

You should grab the Unity NavMesh Components from GitHub GitHub - Unity-Technologies/NavMeshComponents: High Level API Components for Runtime NavMesh Building , it allows alot more control over navmesh functionality, read the documentation on them, should help you. Heres the functions:

NavMeshSurface – for building and enabling a NavMesh surface for one agent type.
NavMeshModifier – affects the NavMesh generation of NavMesh area types, based on the transform hierarchy.
NavMeshModifierVolume – affects the NavMesh generation of NavMesh area types, based on volume.
NavMeshLink – connects same or different NavMesh surfaces for one agent type.

Check it out, might help you :slight_smile:

I’ve tried mesh, but I don’t see how I can make it work with a grid map.

What I did when I needed grid based movement:

  • Work out how wide the grid tiles are
  • Raycast down from the centre of the tiles to see where the floor spaces are
  • Check for each collision point if there is actually space for the character to stand
  • For adjacent collisions work out if there is room for the AI to move to that space/tile