CMCharacter Modules 0.1.0

Ledge Grab

Kind: State · Add Component: Character Modules > States > Ledge Grab

Catches the edge when a jump falls just short. A near miss becomes a save instead of a fall.

Catching the edge of a wall when a jump falls just short, hanging there, and climbing up. A near miss becomes a save instead of a fall.

Inspector
▼Ledge Grab⋮
CharacterCharacter (Character Motor)
Finding a ledge
Low Probe0.34
High Probe1.69
Min Ledge Height1.125
Reach0.15
Max Ledge Slope25
Hanging
Hang Depth1.5
Stick Delay0.333
Auto Climb Drop1.125
Let Go Speed2.7
Regrab Delay0.5
Climbing
Fast Climb Time0.533
Slow Climb Time1.133
Slow Climb Cancel0.933
Climb Inset0.27
The Ledge Grab component in the Inspector, with its defaults.
Origin. Prince of Persia (1989) and Tomb Raider (1996); Super Mario 64 (1996) in 3D platformers.

How it works

The Climbing mode: runs falling at a ledge. Committed until it climbs up or lets go; its kind of air move is hang, which a flight may forbid.

Ledge Grab: falling into a wall whose top is a little above head height, the character catches the edge and hangs, as in classic 3D platformers. From the hang:

  • jump climbs up fast;
  • after a moment, the stick toward the wall climbs up slowly;
  • crouch, or the stick away, lets go. If the ground below is close, it climbs up by itself. Climbing needs room to stand on top. Only flights that allow it grab (not a triple jump, a backflip or a ground pound).

The ledge is found as the original finds it: a low probe touches a wall the character moves into, a high probe touches nothing, and a walkable floor lies just past the wall face, higher than minLedgeHeight above the feet. In the original the hero stands on top of the ledge and the hang is only animation; here the body really hangs against the wall. Numbers from the classic 3D platformer study (D33).

Combine it

  • Needs: Air Move. The Inspector warns while one is missing.
  • Priority 26: when several states could run, the highest priority wins (see How modules combine).
  • Used by the presets: Retro Platformer, Modern Platformer.

Properties

PropertyDescriptionRangeDefault
CharacterThe character this module belongs to. Drag its Character Motor here.None
Low ProbeHeight of the probe that must touch the wall, above the feet, metres.0 or more0.34
High ProbeHeight of the probe that must miss the wall, above the feet, metres.0 or more1.69
Min Ledge HeightThe ledge must be at least this far above the feet, metres.0 or more1.125
ReachHow far past the body's side the probes reach, metres.0 or more0.15
Max Ledge SlopeSteepest ledge top that can be held, degrees.0 to 9025
Hang DepthHow far below the ledge top the feet hang, metres.0 or more1.5
Stick DelaySeconds of hanging before the stick climbs or lets go.0 or more0.333
Auto Climb DropClimbs up by itself when the ground below the hang is closer than this under the ledge top, metres.0 or more1.125
Let Go SpeedSpeed the character drifts off the wall when letting go, m/s.0 or more2.7
Regrab DelaySeconds after letting go during which no ledge is grabbed again.0 or more0.5
Fast Climb TimeSeconds of the fast climb (jump).0.01 or more0.533
Slow Climb TimeSeconds of the slow climb (stick).0.01 or more1.133
Slow Climb CancelSeconds into the slow climb after which the stick or jump finishes it at once.0 or more0.933
Climb InsetHow far in from the edge a climb ends, metres.0 or more0.27

Additional resources