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?

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.