check if can place object


I have a game where I have a 3D terrain. On this terrain the player should be able to place different buildings.

So for checking whether the building can be placed, I was going to raycast at the 4 corners of each building downwards, so that I can compare the y. positions. I those were the same I could have placed a building there.

But I also need to check whether there is already a building placed there. But I couldn’t find a good way to check on the ground if there is already an object placed.

I would use a spherecast but the problem is that while I can’t exactly describe the from and size of the buildings yet, I already can say that they won’t have a circular form. So what would be an easy to adapt and performant way to check the ground for the different types of buildings?

And how could I measure the size of building (radius or so on) in unity length.

Try to watch this guy
He have a pretty good tutorial for your problem.