Check out example codes for "unity spherecast". It will help you in understanding the concepts better.

Code Example 1

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);
  }
}

Learn ReactJs, React Native from akashmittal.com