How to set a camera player (ThirdPersonCharacter) that is always the same distance from the character and, when it meets the ground, only rotates upward when he lifts his head?

Hi guys! I wanted to know how to create/program/configure a camera that follows the character and always stays the same distance from it. Let me explain: When my ThirdPersonCharacter looks skyward, the camera attached to a SpringArm is therefore located downwards. The problem is, when my camera meets the ground, it gets closer to my character as he lifts his head. I would like a camera that always stays the same distance from my character, and that only rotates upward only when the character is looking up, and only when this camera meets the ground.