# Determine area between colliders and save it

Hello,

I hope you can give me some ideas.
Cause I have some solutions but I think there is a much easier solution then Iam thinking about.

I wanna create a zoo simulator.
But now iam stucking.

I need to determine the area between the fences, so that the animals know that this is their area where they have to search for water and other things.

So I need a script/way to detect if there is no space between the fences, and if theres no space, save the area between the fences as a compound.

Here is a picture from what I want.

Thanks alot for any hint/idea!

Your question is pretty much unclear so, in the event that:

• the fences are placed by the player
• you require that all fences are connected together in some manner

The best way to calculate the area enclosed by the fences would be to multiply the sides, as you do to calculate a rectangle’s surface.

Now the -logic- behind the two points above deserves a study by itself, but in simple ords,
I’d suggest:

• create a grid system
• fences can be placed by clicking on a spot first, and on the last spot of the fence afterwards
• you can only create a new fence when it’s adjacent to existing fences, or there’s no fences already