Crouch bug traverses collisions

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By samufly

Hello, I need help with my crouching system, and when I change from standing to crouching, for example, if it is in a tunnel that can only be crouched down, it goes through it. Is there a way for the character to detect that there is a collision above that prevents him from standing up?

:bust_in_silhouette: Reply From: woyosensei

I usually use Area or RayCast to detect if there is any object with collision above characters head. Just set any of these two (I preffer Area for its wider range) to detect only collisions with your ground or whatever and set some bool as a check. It’s not a perfect way but it work for me. You can work around that and improve it if you want.