i am creating my 3d game engine using Opengl.

this question might sound stupid to you but i am still in the process of learning, i have a 3d animated girl that slaps guys of different talls on the face.

however the animation is specified for a tall say 1.85CM. when i want her to slap a guy that is 1.60CM tall then she slaps the space over his head.

do i have to create animations for the girl slapping different talls of guys?!

this would be a lot of work, i hope you give me some insight about how such thing are handled.

also could you please give me some resource on generating animations in runtime?

to get my idea for example take a game like fight night, a head punch would be directed to the head no mater how the tall of the other guy is.

  • 4
    \$\begingroup\$ A very general though hard to implement approach is using inverse kinematics. \$\endgroup\$
    – danijar
    Apr 3, 2013 at 19:02

2 Answers 2


Technique you are searching for might be Inverse Kinematics. In short the input is the desired global pose of single joint (hand of your woman slapping 1.6m guy) which is the end effector. You solve for the local poses of other joints in your animation that will bring the end effector to desired location.

It's explained in detail in Jason's Weber article called "Constrained Inverse Kinematics" in this book. Unfortunatelly I don't know of any good web articles but it might give you an idea what to search for.


If it is just for this single situation of slapping faces, you could simply overwrite the shoulder pitch angle. You could probably work out what it should be with some simple trig, but I would just find values empirically for each male. Of course a full inverse kinematics solver is better, but if your cases are so limited, a simple hack is a better option.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .