I am making a Snake Game. I now need to spawn food at a random location. I have generate this location, but how can I tell whether there’s any obstacles near that point that the to-be-spawned food would not collide with? The method I can think of now is to add a sphere component on my food class. Then spawn the food at that location, and use its sphere component to get overlapping actors, and then check whether these actors are of type obstacle. If I do get any obstacles that overlaps with my food, then destroy this food and choose next random point to spawn. I think this method sounds awkward, since the spawning mechanism shouldn’t work like this, but I cannot think of a better solution. That’s why I am asking whether there’s any function that could tell whether there’s anything near a specific point?
Thanks,
Wcl1993