SphereCastAll doesn't seem to be working

In desperation, I tried this:

RaycastHit hits = Physics.SphereCastAll(transform.position, 100000000f, transform.up, 100f);

and it STILL didn’t work. It returned SOME hits but not all. My world just consists of a small room with some objects in it. Some with rigid bodies, some with only colliders. They are all in the default layer. This behavior just seems completely nonsensical. Can this be anything other than a bug in SphereCastAll?


do you have any colliders set to triggers ? spherecast only detects colliders that are not set up as triggers, so any colliders that have is trigger option checked wont be detected by the spherecollider

If the object is already inside radius, it will not be detected. You can handle this in a couple of different ways. Image you wanted a radius of 10.0. You can do:

RaycastHit[] hits = Physics.SphereCastAll(transform.position-transform.up*10.0, 10.0f, transform.up, 100f).

Another possibility is to do a Physics.OverlapSphere()first, and then to add any new items found by call to Physics.SphereCastAll() with a radius the same size.