So, I am making a 2D block based game. I need to be able to tell if a custom, player made building is completely air-tight (So pretty much detecting if it is a completed house, with no holes outside). I had an idea how to do this, but I don’t think it will work. Here was my first Idea-
So I was going to make an empty game object that would float around the inside of the building with ray casts on all sides checking to make sure there is a wall on all sides. When the game object hit a wall, it would go another way. If it found that there was a wall missing, it wouldn’t be air-tight. Problem is, this probably isn’t the best way to do this, and I don’t know how I would spawn it in the building in the first place(How I would be able to check if one needs to be spawned).
So, I don’t really know how to approach this. Steering me in the right direction would help me out a lot. If there is another post on this or a tutorial you know that could help me, I would appreciate if you could comment it.
Bonus: What would be a good way to get all the air blocks in the room (once it detects the room is air-tight) into a group? Any ideas for that would be greatly appreciated.