Why does a SphereCast require a direction, shouldn't a sphere be in all directions? and how to cast a sphere around my object from it's center in all directions

I’m trying to capture Raycast hits; to get the normal of the objects around my player as in the picture. I’ve been using Physics.spherecast but its behaving as if it’s a Raycast, that is it’s capturing Hits in the given direction.

I’m sure that this is what you’re looking for : Physics.OverlapSphere

SphereCast is like a ray, but with thickness along the ray with given radius (like a capsule).

EDIT: SphereCast still does what you wanted. It’s parameter may seems confusing, but you can put the direction into Vector3.zero to get a perfect spherical shape. Don’t this is what you meant?

Guys i ran into similar problems and here is what I found.

Setting “direction” as Vector3.zero just caused the Spherecast to not work regardless of “maxDistance”.

Setting “direction” as the forward direction (e.g. transform.forward), and setting the maxDistance of a small value example 0.1f, worked.

In my testing,the Spherecast only picks up collisions that happen at the “front half” surface of the Sphere, front being the “direction” that the “Sphere” being casted. Hence if you were to have an enemy facing the positive Z direction and constantly casting a SphereCast of maxDistance of 0.1f (or any maxDistance) in the forward direction, you will notice that a hit is only registered when a collider intersects with the front half surface of the Sphere.

If you move a collider into the sphere from the rear half, it does not register the collision. It does not detect collisions in the rear half of the Sphere, or anything that is already “inside” the Sphere.

Think of the the Spherecast being more of a U-shaped “Sonic Boom” shape cast by Guile from Street Fighter.

Which also means if your “origin” parameter of the Spherecast call, fell right smack on a small target that you intended the cast to collide with, and if your sphere radius is larger than the target collider, you might not actually register a hit…

public static bool SphereCast(Vector3 origin, float radius, Vector3 direction, out RaycastHit hitInfo, float maxDistance = Mathf.Infinity, int layerMask = DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal);

That’s what sphere cast does. From the documentation, “Think of the sphere cast like a thick raycast.”

You might want to look at OverlapSphere as an alternative