Question by 
               SuperRaed · Jul 04, 2016 at 08:03 PM · 
                detectionspherecastphysics.raycast  
              
 
              SphereCast is behaving like RayCast(only detecting object in the given direction)
I want to be able to detect objects of a specific Layer mask within a given radius from my object. I tried using SphereCast with the following code
 if (Physics.SphereCast(transform.position,radius,transform.forward,out hit,distance, enemy)) {
             Debug.Log("hit");
         }
 
               but it only gets triggered when the objects are in line with the direction vector specified in my case transform.forward. why am I having this problem and how can I fix it? btw my game object is a sphere just in case
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by jgodfrey · Jul 04, 2016 at 09:00 PM
You probably want Physics.OverlapSphere(). See here:
https://docs.unity3d.com/ScriptReference/Physics.OverlapSphere.html
Your answer