I learned how to walk today

 

Ninjas walking towards the player. Spheres indicate which foot is planted.

Walking Ninjas

I would like to take a second to talk about a pet peeve I’ve always had with 3d games, and it’s something that I still see in modern games like Fallout: New Vegas (and probably MANY more).

What I’m talking about is when a character walks but their feet don’t make frictional contact with the ground, instead, their feet slide in relation to the ground when they walk. I hate that.

Here’s a rough overview of how to fix it:

Pick a bone to be fixed in the scene. I usually go with the lowest foot. Next, perform a frame of animation and see how much that bone moved. Translate the character the opposite of this bone’s movement, moving the player and leaving the bone fixed in the scene.

Here’s a video showing off the walking, with spheres drawn at the fixed bone. It’s MJPEG. (the low FPS is because I’m using the app itself to dump its screen contents).

I have a demo of this with my framework here (binaries and source). I spent a lot of time revamping my framework; others should be able to build it now. The code of interest is in CNinja::doFrame(). You can also enable the feet balls in CNinja::Spawn().

 

Comments

saluk
29. Jul 2011 · 04:49 UTC
Nice fix for this flaw. It does annoy me in other games as well. The problem with this technique is that you are basing the movement speed on the animation and not the other way around, which is a tiny bit harder to balance than just saying, “well, these guys can run 2 units per second” or whatever. Small price to pay for good looking animation though.