Can't seem to mask CharacterController from Physics.Raycast

I’ve got some GameObjects with Colliders and CharacterControllers attached, and they’re all set to layer 9. When I cast a ray against them with the mask ~(1 << 9), it never hits the Collider, but it can hit the CharacterController. Is there something I’m missing that has raycasts treat CharacterControllers differently from Colliders?

This seems like something that should be fairly straightforward. Does nobody know if CharacterControllers are a special case?

I tried and it seems to work for me:

if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), 100, ~1))
{
   Debug.Log("Bug");
}

When i changed ~1 to 1, it printed “Bug” to the console. If you are still sure this is a bug, report it via Report Bug.app with a sample project showing the problem.

Thanks, I’ll see if I can reproduce it.