TL;DR: How do get rid of the gap between the LowerArm “wrist point” and the Hand “wrist point” in the pictures below where I am using IK?
I’m trying to make a weapon that looks nice, and I understand that inverse kinematics is good for that. I’ve read the article 2 Joint 2 Limb Inverse Kinematics, and I understand some of it, but there are parts of it that I just can’t visualize.
My problem is (I think) that the script provided at the end of the article assumes that the 3 points of the triangle formed by the shoulder, elbow, and wrist/goal all form a plane aligned to the world’s Z and Y axis or something (again, I don’t really know), but they really aren’t, and it’s causing a small gap to appear between the “wrist” vertex of the triangle and the goal position.
You can also see it happen in the demo place provided in the article I linked above:
You can see here that the Hand of the character is not in the same position as the goal position (the red sphere); it is offset by 0.5 studs, the difference between the shoulder position and the wrist position:
When no joints are used, you can align the vertices of the triangle however you want, this creating the desired outcome below:
They way I have my rig set up is like so: The gun is welded to the head of the player, and I re-weld the hands of the character to some parts on the gun that I can animate reloading, aiming, etc.
What I ideally want to happen is to use IK to position the arms so that the LowerArm “wrist point” aligns with the Hand “wrist point”, but being unfamiliar with the math to do so, it’s extremely difficult for me.
I would greatly appreciated if someone helped me get through the math to solve this. Thank you!