I have a rigged model setup my scene of a hand:

I also have position data of a new hand pose that I would like this model to take the form of:

(^plotting of the position data [visually mirrored as well], I included the sample position data in the uploaded project files)

It should be self explanatory, but for the sake of clarity the key points in this position data represent where the joints between each bone are in 3D space.

The problem is (or at least I think) is that I cannot just move each joint in my rigged model to these points. I need to calculate the rotations from each key point to another and set the Bone Object rotations for each bone on my rigged model/skeleton to have it match the pose. And it makes it more difficult because the rotations are relative to bone previous to it, so once you calculate and set the rotation of the parent, it changes the coordinate system of the child.

So, basically I need an algorithm that takes in these key points for each finger and calculates and sets the correct rotations for each bone on my model to match the pose.

I have a very limited background in linear algebra, and I’ve tried so many different approaches to get this right from using basic trigonometry, axis angle rotations, converting direction vectors to Euler angles, calculating rotation matrices and basis transformations, messing with Quaternions, but I’m really struggling to get anywhere, and I’ve been stuck on this for over a week now, and I’ve tried posting on stackoverflow and gamedev and no one seems to be able to give me help or guidance.

Can someone please help me figure out how to this?

I attached my entire project if necessary. After installing the node packages, it should be immediately ready to go. I’m not asking anyone to do this for me, if anyone could at least help me with that math or any other help at all it would be much appreciated. This project is very important to me! Thank you for your time.

project.7z (296.7 KB)

another resource I found: obviously leap motion has a visualizer that’s similar to this. I can’t tell if these calculations in this code leapjs/threejs-bones.html at 5a89a25b5fd627ec0febeb7e8db77c6ca30f612a · leapmotion/leapjs · GitHub are a clue to the calculations needed to help me