title: Physics.OverlapSphere not detecting colliders correctly
body: <p>I'm doing an AI "minigame" in Unity for a College Assigment. I'm trying to make simple agents moving inside a walkable mesh using steerings. Right now I'm with the Flocking steering and I'm using the method showed in <a href="https://gamedevelopment.tutsplus.com/tutorials/3-simple-rules-of-flocking-behaviors-alignment-cohesion-and-separation--gamedev-3444" rel="nofollow noreferrer">this article</a>.</p>
  
  <p>The problem I'm having is that the OverlapSphere function doesn't return the colliders correctly as you can see in the image:</p>
  
  <p><a href="https://i.stack.imgur.com/jEBbF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jEBbF.png" alt="Scene"></a></p>
  
  <p>Here's the code I'm using for the steering. The 8 in the Overlap Sphere call is the layer where the colliders used for this steering are located.</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class SteeringFlocking : SteeringAbstract
  {
      Move move;
      public uint detection_radius = 5;
  
      // Start is called before the first frame update
      void Start()
      {
          move = GetComponent&lt;Move&gt;();
      }
  
      // Update is called once per frame
      void Update()
      {
          Collider[] agents_near = Physics.OverlapSphere(transform.position, detection_radius, 8);
  
          if (agents_near.Length &gt; 0)
          {
              Vector3 final = Alignment(agents_near) + Cohesion(agents_near) + Separation(agents_near);
              move.AccelerateMovement(final.normalized * move.max_mov_acceleration, priority);
          }
  
      }
  
      private Vector3 Alignment(Collider[] agents_near)
      {
          Vector3 result = Vector3.zero;
  
          for (uint i = 0; i &lt; agents_near.Length; ++i)
          {
              result += agents_near[i].gameObject.GetComponent&lt;Move&gt;().movement;
          }
  
          result.x /= agents_near.Length;
          result.y /= agents_near.Length;
          result.z /= agents_near.Length;
          result.Normalize();
  
          return result;
      }
  
      private Vector3 Cohesion(Collider[] agents_near)
      {
          Vector3 result = Vector3.zero;
  
          for (uint i = 0; i &lt; agents_near.Length; ++i)
          {
              result += agents_near[i].gameObject.transform.position;
          }
  
          result.x /= agents_near.Length;
          result.y /= agents_near.Length;
          result.z /= agents_near.Length;
          result = new Vector3(result.x - move.transform.position.x, result.y - move.transform.position.y, result.z - move.transform.position.z);
          result.Normalize();
  
          return result;
      }
  
      private Vector3 Separation(Collider[] agents_near)
      {
          Vector3 result = Vector3.zero;
  
          for (uint i = 0; i &lt; agents_near.Length; ++i)
          {
              result += agents_near[i].gameObject.transform.position - move.transform.position;
          }
  
          result.x /= agents_near.Length;
          result.y /= agents_near.Length;
          result.z /= agents_near.Length;
          result *= -1;
          result.Normalize();
  
          return result;
      }
  
      private void OnDrawGizmos()
      {
          Gizmos.color = Color.yellow;
          Gizmos.DrawWireSphere(transform.position, detection_radius);
      }
  }
  </code></pre>
  
  <p>The expected result is the OverlapSphere returning correctly the number of colliders inside it.</p>