1
\$\begingroup\$

Say my character has a jog animation. Assuming Y is vertical, his feet leave the ground at Y=0 and hit the ground again at Y=0. This works fine in a world like that of Minecraft, where every surface the player could traverse is flat.

Now say the character is jogging through hilly terrain. Without any transformations, the animation would break through the ground at certain points. (As the character's foot is lifted and moved forwards, it would go straight through the hill.)

How do I remove this artifact? Do I ask the artists to create separate animations depending on the grade of the terrain? Is there a standard system to resolve animation-world collisions that I'm unfamiliar with? Or is there another more logical approach I haven't thought of yet?

\$\endgroup\$
  • \$\begingroup\$ Is this 2D? 3D? Sprite based, or bone based? \$\endgroup\$ – Steven Nov 24 '14 at 20:26
  • \$\begingroup\$ @Steven 3D, bone-based. \$\endgroup\$ – Proxy Nov 24 '14 at 21:53
1
\$\begingroup\$

There are a number of techniques used to solve this problem. Generally speaking the technique is called Inverse Kinematics, whereby after the pose is complete, the pose is modified to fit to a specific point - hence being Inverse Kinematics - http://en.wikipedia.org/wiki/Inverse_kinematics

This can be solved through various means - animation or algorithm. Here are some links to techniques, both of which I have seen used on projects I have worked on:

In Mechwarrior, back in 2003, they used a blender to mix different animations to put the feet all in the right places:

http://www.gamasutra.com/view/feature/131863/animation_blending_achieving_.php

In Zoo Tycoon, they used a PID algorithm to get the feed to line up with the terrain. Again, back in 2004 - search for Zoo Tycoon the the following PDF:

http://twvideo01.ubm-us.net/o1/vault/GD_Mag_Archives/Game.Developer.2004.06-07.pdf

The actual path you need to follow will depend on performance limitations, and the aesthetics needed. PID, or blending, or serious IK solving - it's something you need to experiment with and decide.

Here's links to more samples:

http://www.3dkingdoms.com/ik.htm http://www.emagix.net/academic/item/inverse-kinematics-solver-in-c

Good luck!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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