Grid based movement in 3D environment

(Picture from google to explain the question)

We are working on a turn-based top-view tactical game. We want our character to move based on mouse click. When clicked the character will move to the designated tile.

I’m thinking that in order to achieve this we need to generate a grid based on the 3d level model. The grid also needs to be able to detect level difference in height.

This images has a texture that shows the tiles of the grid.

12150-red-d3d-bic4dvr-01.jpg

Is this the correct approach? Can I get some directions on how to implement this kind of grid generation?

– edit –

We just had another idea, we could get the axes of the map model and draw a 3d wireframe grid with gizmos. Then we can position path nodes by clipping to the wireframe which are walk-able / climbable terrain for our character.I would also appreciate feedback on this.

Solved!

  1. Render grid gizmos based on given size (or attach gameobject to take X, Z from)
  2. Grid level can be changed with CTRL + and CTRL -
  3. CTRL W performs a raycast on mouse position, if location hit and Y axis within grid level (ex: Level 1 = Y axis between 0 and 1, usefull when dealing with stairs) a Waypoint is placed.
  4. Waypoint is empty game object with Waypoint script (gizmos wireframe circle in editor)
  5. On execution the connection between waypoints is determined by a script based on the height of a way point. (so stairs are climbable, but you can’t go up a level without them)

Image of current result in the editor. (Grid level 1)