Not a direct solution for your question, but this might be useful :
There’s an option in the Character Movement component to use a flat base instead of a round one.
Use Flat Base for Floor Checks : Performs floor checks as if the character is using a shape with a flat base. This avoids the situation where characters slowly lower off the side of a ledge (as their capsule ‘balances’ on the edge).