You should take a look at that axys demo I believe it was called. I don't know if it is open source anymore, but it was open to view the code at one point in a demo. It was a 2d scroller, but it had ledge climbing and all of that worked out in it. I think I still have the demo because I was also interested in ledge climbing and tracked it down. It should probably work the same in a 3d environment but I'm not sure.

Either way good luck, you may have figured it out already from these earlier posts.