How would I create a raycast that ignores Character Controller

I am currently making an foot IK system right now for my game. But despite all of my dificulties the only problem I have is that whenever I enable my character controller the collider blocks off my raycast for foot IK, so I get this floating effect. Is there any way I can make my raycast ignore my character controller. I know how to utillize layers, but the problem is that the component, character controller collider, cannot have a layer? or can it? How would I make my raycast ignore the character controller?

It’s true that a component can’t have a layer, only a gameObject can. However, this is irrelevant since all components on a gameObject are bound to the gameObject’s layer. So just make the RayCast use a layermask that excludes the character’s layer, and you should be good.

Don’t set the layer to the component but to the gameobject.

GetComponent<CharacterController>().gameobject.layer = LayerMask.NameToLayer("nameOfYourGameObjectLayer")

LayerMask rayMask = 1 << LayerMask.NameToLayer("nameOfYourRayLayer");

if (Physics.Raycast(from, direction, distance, rayMask))
            Debug.Log("Hit something, but not the CharacterController");

Pretty much what @Cherno said, but you can use the inbuilt “Ignore Raycast” layer on the character controller.