How to detect edge so the character can fall and not stand in "air"?

Hello everyone,

how to detect edge so my character does fall sooner and not stand in “air”? Re-sizing capsule is not an option since I have different characters with different sizes. Character should detect ledge while they are over it with their legs and fall down immediately.

Thank you for your help and best regards!


is there something going on with the collision box on your ground mesh?

I don’t think so. This is a standard 3rd person character template where the capsule is holding the character on the edge. If I move the character a bit forward it falls down.

If looks like the bottom of your character collider is still over the floor collider, hence it’s not triggering the fall.

Decrease the radius of your CapsuleComponent (under section Shape > Capsule Radius). The downside of this is it will allow your character to get closer to walls and other obstacles.

Edit: Sorry, I just re-read you post. You could try and dynamically assign the Capsule Radius based on the scale of the character. Alternatively, you can try and use line tracing from your legs down and temporarily disable capsule collision when nothing is detected, but this might be expensive on the performance if done per frame.

Hello, thank you for your help. I already did that but in my case I am doing one funny character that has a larger head and thinner legs so it looks really “wrong” to have its nose in the wall :slight_smile:

Do you think it would be a good idea to at least add additional Capsule in front of the character and measure the distance to other actors, just to prevent it to get too close and sink the nose into the wall? Or is there a better solution?

Kind regards

You could add an extra collider to your Character (like a sphere for the head). Just need to make sure it won’t catch the floor when falling - for example detect free fall and disable it’s collision, otherwise it could look really funny :wink:

That is what I will do :slight_smile:

It’s not ideal to change the Collision for this.

To tweak how “early” we fall we can play with the “PerchRadiusThreshold”. parameter on the UCharacterMovementComponent.


Thank you , it works perfectly. I did my own solution more than a year ago but I overcomplicated the whole deal. It worked well but this one is way simpler :slight_smile:

Thank you! I have been trying to find a good solution to this and I am surprised that the threshold variable is not featured more in the documentation or in people’s videos. I’ve seen people do very advanced capsule resizing and other hacks, and there was a variable for it all along…

set this variable : bUseFlatBaseForFloorChecks = true