0 votes
asked in General Help by
Hi, 
I'm an Unity beginner. Is there any IK solver suitable to apply to the VR hand model with recognized hand gesture 21 key-points in the real world? And I am wondering if there is an example for reference. 
Thank you!

1 Answer

0 votes
answered by (20.2k points)

Hey,

I do not have a very solid generic solution for this yet. But if you have 21 key points for a hand, that is not actually an IK problem, but a mapping problem of posing the hand of an avatar to something like a SteamVR hand model.

It is a bit tricky because the avatar hand bones have different bone orientations, but it can be overcome with this bit of code:

/// <summary>

/// Used for matching the rotations of objects that have different orientations.

/// </summary>

public static Quaternion MatchRotation(Quaternion targetRotation, Vector3 targetforwardAxis, Vector3 targetUpAxis, Vector3 forwardAxis, Vector3 upAxis) {

Quaternion f = Quaternion.LookRotation(forwardAxis, upAxis);

Quaternion fTarget = Quaternion.LookRotation(targetforwardAxis, targetUpAxis);

Quaternion d = targetRotation * fTarget;

return d * Quaternion.Inverse(f);

}

So for example if your target finger bone has positive Z pointing towards the next finger bone and positive Y pointing up, and your avatar finger has negative X pointing towards the next finger bone and positive Z pointing up, this is how you would use it:

avatarBone.rotation = MatchRotation(targetBone.rotation, Vector.forward, Vector3.Up, -Vector3.right, Vector3.forward);

Best,

Pärtel

Welcome to RootMotion Q&A, where you can ask questions and receive answers from the developer of Final IK and PuppetMaster and other members of the community.

Post as a guest, create an account or login via Facebook.

Please use the correct category when you post your questions.

...