- Home /
Question by
NassarOfficial · Jul 13, 2012 at 06:15 PM ·
terraindatabasegriddata
Assigning Data to Terrain Grid Squares
Hello, I created a projected grid all over my terrain. I am attempting to create something similar to Sim City. I need to divide my terrain into many squares or boxes that should hold data such as altitude, access to water, education etc. Can anyone lead me to a method of how it could be done, also if this can be done using a database?
Comment
Answer by teomaragakis · Apr 26, 2014 at 09:15 AM
Try a multi-dimensional array:
create something like a int[,][] mapData. It would work as follows:
// x,y are the coordinates on the grid
int[x,y]['alt']= altitude;
int[x,y]['water']= access_to_water;
//etc
Your answer
![](https://koobas.hobune.stream/wayback/20220613074135im_/https://answers.unity.com/themes/thub/images/avi.jpg)