Hello,
am new on unity. I would like to ask how can i find nearby objects from lets say an x object. Am trying to build a game and am trying to find the enemies around me based on a threshold distance. Am using Spherecastall but for a reason i think so that returns only the object in front and not around.
Use Physics.OverlapSphere.
–Eric
Seems to be best solution. still have some false positives basically the object who is the center of the sphere.Actually its collider.
EDITED:
Fixed the problem be using 2 OverlapSpheres: Inner and Outer
More here: Physics.OverlapSphere with a min radius? - Questions & Answers - Unity Discussions
Instead of doing 2 sphere casts, it would probably be much simpler to do 1 and skip the result if collider == me.