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:




Unity Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Get Hands-on Experience in Programming

Highly available cross region application architecture leveraging MongoDB

Embracing Dyslexia As A Software Engineer

A Coding Blog Bitcoin Story: The Introduction

Permify: From spaghetti authorization code to single source of truth

Bringing death certificates to life with agile tools

Installing CUDA Toolkit 10.0 and cuDNN for Deep learning with Tensorflow-gpu on Ubuntu 18.04+ LTS

Unpopular opinion: Jenkins is still the best CI/CD tool

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
Mike Brisson

Mike Brisson

Unity Developer

More from Medium

Google Maps & Location Services

Adding Effects to our player

2.5D P1 Framework: Complete!

Adding shields to some enemies