Computing rotation required to move to new position


I’m working on a UI that will allow the user to manipulate the pose of a human 3d model. The idea is that the user can pick a limb and move it by rotating the corresponding joint. See image below.

When the user is dragging the limb to a new position, how can I calculate the required joint rotation to move the limb there?


Maybe this helps:

in the picture I see you have the wrist/hand selected. do you want to rotate the forearm or the whole arm? If it’s the arm you may have to code some IK.

I want to rotate the forearm as a first step. Once I get that working, I’ll work on IK.

Thanks. I’ll take a look.