Search Unity

OverlapSphere Max objects returned 128

Discussion in 'Physics' started by juffowup, Dec 7, 2014.

  1. juffowup

    juffowup

    Joined:
    May 10, 2014
    Posts:
    7
    In my game I'm setting off a bomb in a large swarm. Physics.OverlapSphere seems to return a maximum of 128 Colliders. That only accounts for a portion of the swarm inside the blast radius. Is there a way to remove that cap?

    I think I can work around the issue by checking to see if 128 was returned, moving those 128 to a different layer, then calling OverlapSphere again. But, I'd rather the function just gave me the correct result the first time.
     
  2. SpeakUpGames

    SpeakUpGames

    Joined:
    Nov 25, 2014
    Posts:
    56
    Could you possibly instantiate an empty game object with a sphere collider with IsTrigger set to On? And do some manipulation in OnTriggerEnter.