- Home /
check if can place object
Hey,
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.
Answer by NoName115 · May 08, 2014 at 10:20 AM
Try to watch this guy https://www.youtube.com/user/UnityChat/videos He have a pretty good tutorial for your problem.
Yeah that's what I already was going to do . But I think it's not precise enough. As it doesn't real check whether there is building or other object underneath.
//Could somebody please make this a comment.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Clicking on an Object to Make it the Variable Target 1 Answer
Raycasting and Tag Checking in C#? 1 Answer
NPC sight by collider 0 Answers