Unity Spherecast

void CheckSpherecast(float radius, float detectableDistance, LayerMask detectableLayer) {
  Ray ray = mainCamera.ScreenPointToRay(Input.mousePosition);
  RaycastHit hitInfo;
  if (Physics.SphereCast(ray, radius, out hitInfo, detectableDistance, detectableLayer)) {
    Debug.Log(hitInfo);
  }
}
Logan Press