CheckCapsule always returns false

I’m using the following method to check whether my rigidbody character is grounded. It’s based on this answer for a similar problem.

public bool PlayerIsGrounded(){
  return (Physics.CheckCapsule(playerCollider.bounds.center, 
                               new Vector3(playerCollider.bounds.center.x,
                                           playerCollider.bounds.min.y - .1f,
                                           playerCollider.bounds.center.z), 
                               .89f,
                               playerLayer));
}

The method is in a script attached to my Player game object, which has a rigidbody and capsule collider (0.89 radius, 4.5 height). The Player game object is also on the Player layer, hence the layermask. The problem is that the method always returns false no matter what I do. If I remove the layermask, it always returns true. What’s going on?

I think that the CheckCapsule is a function that checks if it’s colliding with an object specified in the layermask, try to remove the player from the layermask and add there a ground layer.

In my case the problem stems from mishandling the playerLayer variable. I had originally written this to specify the tenth layer of my project:

playerLayer = 10;

Instead, layers must be assigned to variables like so:

playerGroundLayer = 1 << LayerMask.NameToLayer("Default");

Also, per Babish’s answer, you need to specify the layer you would like CheckCapsule to return true upon collision, not the layer you would like it to ignore.