Can Physics.SphereCast recognize only Sphere Colliders?

Hello,

I’ve been trying to use Physics.SphereCast in order to find out whether I can place a ball in the game scene or not. This scene is populated with some other balls, but also with some walls. For some reason I only get a result when the SphereCast hits an object with a Sphere Collider attached. When it hits a wall - with a Box Collider - or any other test object that has no Sphere Collider, there will be no collision detected.

Can it be so that Physics,SphereCast can only recognize Sphere Colliders? If not, what am I doing wrong?

what i knew is that Physics.SphereCast recognize all the colliders . Not only sphere colliders .

I think Layer-Based-Collision is what you need :wink: Just place your spheres on a seperate layer and only cast against that layer by passing a layermask to the SphereCast call.

edit Just to avoid confusion, you don’t need to set anything in the collision matrix since that’s for collisions between objects. All you need is setting the objects you want to hit on a seperate layer and add a layermask to SphereCast (the last parameter)