- Home /
Question by
xthunderduckx · May 16, 2019 at 07:28 PM ·
physicsraycastingspherecollider
Check whether objects are within a sphere of influence
I'm creating an explosive weapon, and I need to be able to tell if enemies are inside of a sphere of influence. The issue I have is that I also need to be able to stop enemies who are behind walls from being hit by this sphere.
Right now I have an idea in my head that I can create a sphereOverlay, and for every single collider it touches, excluding walls, raycast towards the enemy in order to make sure it isn't going to hit a wall. Is there a more efficient way to get a list of every single enemy within a radius and only damage the enemy if they are not behind walls?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612201539im_/https://answers.unity.com/themes/thub/images/avi.jpg)