How to check if enough room for collision capsule

Hi, how to check if player is under something and cant go from crouch to stand? crawling and crouching is ok, but when no key is pressed then the collision capsule gets bigger because of idle animation and player stucks into objects. player needs to stay crouched while there is not enough room for capsule