Getting an object to follow/crawl along walls

Just wondering if anyone has a good solution to have objects follow or crawl on walls and surfaces. Really the problem comes in on any angles in the terrain above 180 degrees (outside angles).

Right now I have objects in contact with walls turn off gravity, and apply a force towards the wall normal. This works fine for all interior wall angles, but with exterior wall angles, if they travel very fast at all, they lose contact and thus the force stops being applied.

Worst case is when coming to an edge of a cliff, and the object needs to travel down the wall.
Came up with a very non-intrusive to the simulation solution to this problem. This thread helped me out:

http://farseerphysics.codeplex.com/discussions/244934

I did a similar thing, only using prismatic joints instead, because I needed a sliding object, not a rolling one. Basically its as if I had a contact point that could be set to disallow separation from the normal of the contact manifold.

Might be interesting if this was a built in feature, like during the pre-solve step you could set a flag that says "don't allow these bodies to separate along the manifold normal". It works at relatively fast speeds as well.

I think maybe what this is really behaving as if Box2d had separation contacts, that is, contacts that are not separated, but were connected last update, which would allow a bias to fix the separation. Some other physics engines implement this. I just used a sensor that is slightly larger than the object to find near by fixtures that would have been connected recently.

The hack here really is that I'm assuming the closest fixture after separation a the fixture to be anchored to, maybe a built in version wouldn't work so well without that assumption when moving between fixtures.

This solution works very well even for rather high speeds. It also conserves momentum perpendicular to the normal of the surface.

Original thread: https://box2d.org/forum/viewtopic.php?t=7989