# Platforming - Hanging off of cliffs and edges? [duplicate]

Possible Duplicate:
Programming a climbing system like tomb raider

I've been interested in platforming gameplay dynamics for a while now. What I'm trying to ask is how games like Assassin's Creed, Prince of Persia, or any platformer do the environment interactions like hanging off of and climbing edges, etc. I have no idea how this kind of gameplay can be programmed.

In 3D games, the character is usually a capsule, so when the character falls off of a ledge and the grab onto it, where would the capsule be ? I'm confused... How the heck is this done ?

• I don't know the answer, but what I think would work is checking which part of your upper bounding box is colliding with a ledge. You know when it's a wall by its normal vector. If any of the normal vectors of the connected faces ( to the wall) point 90 degrees up compared to the normal vector of the wall then you could say it's an edge. I've never done it myself and my thinking might be far too complex. Perhaps adding pointers/hint objects to your environment would also help. Aug 24, 2012 at 2:35
• Also have a look at: gamedev.stackexchange.com/questions/10809/… Aug 24, 2012 at 12:55
• Thanks guys. buumzack, I didn't even consider "climbing" for a keyword. Thanks for the tip :) Aug 26, 2012 at 0:39

There is a LOT of hard work going into games like Assassin's Creed to make it work. The animation system and character animations are among the most complex (if not the most complex) in the industry.

I the general case, however, there are many different ways to solve this.

One is to add an additional hitbox to the character and one near ledges, test when those intersect, and then grab the edge info from the efge's hitbox.

Another is to simply use ray casting and test for collisions at roughly the height of the chafacters's arms while testing for a lack of collisions at the character's head height (L4D uses a system similar to this for making zombies climb things... Which is why you sometimes see them climb over light posts instead of simply running around them).

You could add a surface flag to walls below ledges and check when the players capsule collides with it. You could a plane extending from the ledge and check when the top of the player collides with that. You could attach ledges to navigation nodes and check for collision there.

A lot of this data and be automatically created by post-processing the level geometry (especially low or mid LOD levels). It can also be produced manually if designers are worried about players being able to climb willy nilly over any obstacles.

The hard part is animating it all. You need relatively fancy animation blending to do it in 3D. Simpler 2D games after just directly switch to a grab ledge frame of animation, but this requires more precise detection of when the character is in a position to grab a ledge.

In most cases I've seen, the hitbox around ledges approach is taken. If the player collides with one of them and is falling, he can grab the ledge. Some extra work to check that the collision is near the players hands and that the player is facing the ledge makes it feel an look better. Aside from that, te animation system has to be able to be given positions to attach the hands and to meld that with the existing falling ankmstion and the climbing animations.

• " You need relatively fancy animation blending to do it in 3D" If I'm not mistaken that's called tweening. Anyone who can confirm that? Aug 24, 2012 at 2:40
• I am talking about much more than just tweening or interpolation. You need freeform positioning of bones, with physics helping out, and blendin that with your other tweened/ interpolated animations. Aug 24, 2012 at 2:43
• I guess I misread it. Aug 24, 2012 at 2:44
• This is very good. Thanks for the reply! I was thinking about the raycasting method too. As for animation Havok mostly has me covered there. Aug 24, 2012 at 11:38