- Home /
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.
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.
Answer by Phim · Jun 21, 2013 at 10:33 AM
Solved!
Render grid gizmos based on given size (or attach gameobject to take X, Z from)
Grid level can be changed with CTRL + and CTRL -
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.
Waypoint is empty game object with Waypoint script (gizmos wireframe circle in editor)
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)
Your answer
Follow this Question
Related Questions
Having trouble with grid movement 1 Answer
Making a bubble level (not a game but work tool) 1 Answer
How to move character in a grid-based area? 1 Answer
3d grid of game objects - C# errors 1 Answer
Best way to move my player (3d) 1 Answer