Create a Ledge Grab System in Unity

When using animations that require motion, there are 2 ways to move the player…root animations or baked animations. Using root animations move the player for you like this:

Baked animations move in place and allow the scripts to drive the motion:

We will be referring to the latter in this article. When programming the motion for ledge grabbing we will need a few things:

  1. Position of our hands during a ledge grab animation
  2. A trigger to detect when we should enter the ledge grab animation state
  3. The position the hands need to ‘snap to’ on the ledge
  4. The position our character needs to be in after climbing up

If you don’t have a worthy jump animation, you can head over to to grab anything you like for free. Once you have imported your mixamo animation, make sure that you set the rig to humanoid:

For our hand position, we simply need to add a trigger collider at the position of our hands during the ledge grab animation:

Make sure to add a rigidbody with gravity turned off

Once we have this trigger in position, we can disable the mesh renderer and add another trigger to our ledge:

With these first 2 steps complete, we can now trigger our hanging animation. Give the ledge trigger a tag of “Ledge” so we can detect it in the OnTriggerEnter method:

We want to snap the hands to the ledge but we also want this to be modular so we will use an offset from the ledge trigger to adjust our position. Move your character in the scene to where it needs to be snapped to, then subtract the values of the current position from the values of the ledge:

We can now add this offset to the OnTriggerEnter method:

We now have a modular ledge hanging system. All that is left is to climb up. Head back to (unless you already have an animation) and select a climbing animation.

If the animation doesn’t have an “in place” option, you will have to manually select “bake” within Unity:

You can set the character to climb after detecting input or you can have it climb immediately from within the Animator:

The only problem that we have is that once the baked animation of the climb ends, our character will still be at the location of the hanging pose. To remedy this, we can simple add another offset when the climbing animation has ended.

With the climbing animation selected we can add a behaviour:

Next we can add an event within the newly created behaviour that will fire off when the animation has ended:

Back in the Player script, we can subscribe to the OnClimbComplete action and move the player to our final idle position:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store