Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my game, I'd like my character to be able to grab and hold onto ledges, and to be able to pull themselves up if there's room to do so.

How do I detect if there's a ledge, and if the character has enough space to climb up?

share|improve this question
This question was created as a canon version of two earlier questions. See the meta discussion here. – doppelgreener Oct 20 '12 at 0:34
Also, linking the questions talked about in meta:… and… – Byte56 Oct 20 '12 at 0:54
up vote 13 down vote accepted

The video for Overgrowth Alpha 132 shows how they implemented ledge climbing.

Their method should work in any engine, even 2D engines where you'd use a rectangle and circle instead of a cylinder and sphere.

Their ledge detection involves two parts:

Wall detection (using the sphere)

The game checks if the player's currently colliding with a wall. If there's a wall, there might be ledges the player can grab onto. The second part takes over to analyse the ledges.

Ledge detection (using the cylinder)

If the player's contacting a wall, a cylinder is swept downwards from a certain distance above the player's position until it touches a ledge. This determines three things:

  • Whether a ledge exists above the player
  • The ledge's height
  • Whether there is room for the player to climb up onto the ledge, considering the cylinder occupies the same horizontal space as the player.
share|improve this answer
Amazing method, and fantastic example +1 – Bugster Oct 20 '12 at 12:19
"a cylinder is swept downwards from a certain distance above the player's position" What distance? This is very important when dealing with indoor environments (you'd intersect the ceiling by accident). – Dudeson May 17 '15 at 3:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.