- Home /
RTS Grid Idea?
Hi, i'm making a cartoony RTS game but have a problem on making a grid.I have know idea how, my first try was i created a square and added 4 cubes on each side, the cubes on side was hit by a raycast from the mouse position,when i hit a side of the cube, depending on the side, it would face different ways. although this works i was wondering if there is a better way of doing this?
Thanks
Answer by Piflik · Jan 03, 2013 at 03:13 PM
I did a grid for my game once (hex, but that doesn't matter) and the implementation was a simple two dimensional array. To get the tile you are clicking on, you will have to divide the transform.position components of the raycast point by the grid width and cast the result into an int. If you want to place something on a grid point, take that int and multiply it with the grid width.
i have never used a array? could you explain abit more.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Instantiate prefab within parameters?(Javascript) 1 Answer
What is wrong with my code? 1 Answer
What is a 2D Array? 3 Answers
[Android]How to move an object and have it snap to grid? 1 Answer