Collision Wall beginner

hello, I have a question my character can lean forward and backward, in fps view when he leans his head crosses the walls (if he sticks to the wall) how can I make him “bump” / block instead that his head goes through?