- Home /
Any resources for using grid/tile data structures with terrains?
I have a terrain and I want to divide it into 1x1 meter sections so I can keep track of where objects are placed (on a grid) and the state of the tile (on a grid).
The tiles are currently composed of:
Position on the terrain.
Position on the grid.
The state of the tile.
A gameobject.
The problem I've run into is trying to find the size of the terrain. I looked inside the transform component and it only has data on the position and scale of the object. I know terrains default to 1000x1000m, but can I assume that length = 1000 * scale.z
and width = 1000 * scale.x
?
Answer by Nemox · Mar 24, 2012 at 01:32 AM
I believe if you want a 1:1 ratio between squares and meters, you'll have to make the terrain size match your terrain's resolution. So if your resolution is 1025 (resolution is always power-of-2 + 1), your length and width will have to be 1024. Height as well I believe. Might take some experimenting.
Your answer
Follow this Question
Related Questions
Grid Movement VS Free Movement 1 Answer
Grid and or Tile System 0 Answers
Hexagonal grid with 120 degree angles 1 Answer
The grid won't cover all the area of the wall 1 Answer
Paint Grid Texture 1 Answer