Data Grid

Hello!

My game generates mazes at random using prefabs for pieces (straight hall, turn left, turn right ect.). I am looking for the best way to check how much space a particular pieces is taking up so that I don’t have two pieces generated intersecting eachother.

The pieces are all set up to work with Unity’s units (eg. a straight hall is 2 units wide and 6 units tall). I am assuming the best method is to use some kind of grid array setup or even voxels (right?). I even thought of using an image where each pixel is one unit and have unity write pixels to represent space taken up.

My question is, which method would be preferred before I embark upon it?

personally, I would just create an array, and update it when I put something down. That would be way faster then attempting to do collision detection, or using voxels, etc.

The thing is I am unsure on how to pull that off since just saving its position wont work.