CapsuleCollider check if grounded

So i have a problem checking if my character is grounded, and it is tied to the position of the capsule collider, I just started unity so I’m not sure what I did wrong. The problem is that the spherecast returns false, like it didn’t hit anything.

Here are some images of my character/capsuleCollider to better illustrate.

If the collider sticks out of the character as shown on the first picture, it works, but my character is floating 50cm in the air.

Here is the code showing how i detect if im grounded. Keep in mind I’m working with a rigidbody and not a charactercontroller.

  bool IsGrounded()
  {
    Vector3 p1 = transform.position;
    float distanceToObstacle = 0;                               
    RaycastHit hit;
    // Cast a sphere wrapping character controller 0.1 meter down to check if it hits anything
    Collider collider = GetComponent<Collider>();
    if (Physics.SphereCast(p1,  collider.bounds.size.x / 2, new Vector3(0,-10,0), out hit)) 
    {
      distanceToObstacle = hit.distance;
      if (distanceToObstacle < 0.1f)
      {
        return true;
      }
      else
      {
        return false;
      }
    }
    else
    {
      return false;
    }
  }

Thanks that totally helped. I was looking for an answer and that was it. It was the only one so far @effekt