Uncrouching Collision Detection

So I have made my own function which crouches and uncrouches the current player. But when they uncrouch, if they are below a box, they go into the box (have a collision with the box) and the output window tells me that the current player is stuck.

Is anyone able to shed some light on how I could detect an edge collision or stop the user from uncrouching if, when they press the key to uncrouch, they would be colliding with an object?

There are a few ways of handling this:

  1. Create a volume that consistently keeps the player crouched while inside of that volume. Then upon exit allow the player to stand. This one will feel tedious when putting it together but if you can do it right it’ll be very modular which is great.

  2. Line Trace above the character and perform some sort of equation based on the character height. This one might be less of a hassle to do but it’ll still require abit of math. Just do a simple check to see if there is an object directly above the character and the distance between that impact point and the character’s current location (Make a socket at the head and check from there). At a certain distance allow the player to uncrouch.

I’m sure someone else might have another way of doing this… but it doesn’t really matter since there are endless possibilities to achieve this kind of goal and what we care about is the result. Good luck! :slight_smile:

Thanks, I think I’ll go the Line Trace option just because its easier.