I am making a 3D Tanks shooting game. My goal is to drop random bonus in every 10 seconds. Problem here is, there are some houses and objects, on which dropping the bonus is not right. So how to make it so that bonus only drops on the ground (random place at ground)?
There are several ways to solve this, but one way would be to assign all your objects that would not allow Bonus spawning position overlap a Layer or a tag, and then Ray Cast check down against the ground in a vertical ray and check if it hits an object that is not allowed to spawn on, and then find a new random position until it can spawn.