Michael Davis

May 27, 2021

6 min read

Climbing Ladders in Unity 3D

Yet another way to gain elevation

So THIS is how you get to the Cloud District

Functionality

The first objective list is:

  • Give the player and the ladder both an idea of what it means to be on or off a ladder
  • Get the player on the ladder with a keypress.
  • Disable the normal movement when on the ladder
  • Enable vertical movement when on the ladder.
  • Stop the player at the top of the ladder.

Get On With It

Now, let’s tell the ladder and the player what they can do with each other. Add a new trigger box collider to the ladder and extend it over the space where the player will climb up the ladder. Also put a rigidbody component on here and turn off gravity.

Lining Up Limb and Ladder

So, if we run this as we have it, here’s how it looks.

Exiting the Ladder

At this point, we’ll need to pull some more animation shenanigans. This process is very similar to the cliff grab climb up, so I won’t quote the full pseudo code in this section — see the previous article if you want more info.

lol