Check Ceiling If Crouching (Paper2D)

Hey, UE forums. I’m having an issue where if I’m crouching and a ceiling is too low, I’m able to just pass through it when I stop crouching. Is there any way that I can detect a ceiling and keep the character crouching until they move away from the ceiling?

Thanks.

Yeah probably with a trace. Get the actor location, get the up vector, multiply up vector by an integer which will serve as the distance. Add the actor location and the result of the upvector and int, that’ll be your end trace. Start trace is your actors location. Have it check for any actor, if it returns something that is not self while you’re crouching, keep the logic of your crouching going else, return back to standing.