Ledge Up
Ledge Up occurs when the player is near a ledge and presses the jump input while in the air.
It's purposely not automatic because I wanted to force the player to gain some skill in performing ledge ups which I find more rewarding to pull off than if it just happens automatically

Mechanic feel
Vertical
It makes sense in realistic scenarios if you're pulling yourself up a ledge you are first going to be met with gravity pulling down on you before you over power it and toss yourself on the ledge
Therefor a float curve defines the vertical behavior during the ledge up which gives the nice visual effect of "being pulled down by gravity before throwing yourself up onto the ledge"

Horizontal
When a ledge up occurs we pre-compute the final destination of where we can place the player, so we already have a target location.
Horizontal movement is just simply lerped by some configurable scale from the original location to target location.
Does player input conflict?
Input is disabled during ledge up
As a reminder, its a design decision I made that ledge ups cannot be cancelled.
No: During a ledge up player input is restricted, but the entire encounter takes nearly ¼ of a second, and input is returned to the player after so in the event they want to bail from the ledge up they can still hold the movement direction they desire.
Ledge Detection
Ledge detection is contained in its own component so that in the future any character would be given ledge up behavior simply by adding the component, calling LedgeUp , and the component will handle the rest.
All the following checks occur within the LedgeUp function to determine if we can actually perform one.
Check: In Air
If the player is in the air for any reason (either on their way UP or DOWN) a ledge up can be completed.
Check: Something is Reachable
Check if there is something collidable in front of the player
In front of is purposeful; its a design decision not to allow ledge upds for ledges the player isn't looking at

Check: Ledge Exists
Okay we know that there is something collidable in front of the player, now check that it's a ledge
What is a ledge?
an open space above a surface at least wide/ deep enough to stand on

Check: Ledge Surface is Walkable
Check that there is surface we can stand on by reaching out and raycasting down to check we collide within a certain distance

Check: Ledge has room for player
Check that there is enough room for the players capsul component on the ledge

Ledge Found
As mentioned, when the player attempts to perform a ledge up we pre-calculate everything to see if they can, and thus know where the should end up.
Once we deem that a ledge up can occur (via all the checks below) the component modifies the character's position by lerping their position according to the LedgeUpLoc and LedgeUpHeightCurve


Last updated