- Home /
How to check whether gameObject is on even ground?
I am developing a "city builder". When the user clicks on build a building will appear and will follow the cursor until he clicks on the terrain. I then save the position of the building in an array. When placing the next one, it will be checked whether the array is empty for this position. If so, it can be placed. If not, it will disappear until you move the cursor away from that position.
That works pretty fine. But it is not exactly what I wanted.
I want that, while placing, there is a check whether the area the new building would occupy is empty and on even ground.
How large is your grid? If it a generally small grid like 6x6 I would just recommend saving the states of the tiles in an array.
$$anonymous$$y terrain is 2000x2000 and the grid's size is 25x25
You could use 2 dimensional arrays. That should most certainly work. Especially if the grid is only 25 by 25.
I told it wrong. I meant the size of a til within that grid would be 25x25.
Your answer
Follow this Question
Related Questions
How to stop placing a building on an obstacle 1 Answer
Creating a 68x68 grid of trigger cubes 2 Answers
Programming an isometric (top down) grid 0 Answers