Hand IK With Virtual Bones in UE5


This week I finally found the solution to keeping hands attached to weapons in any animation state. But before we talk about the solution that UE5 offers, we have to understand three concepts in animation: FK, IK, and "swimming". While I am certainly not an animator, nor do I think I can explain these with complete authority, I can confidently say that I understand them more now than I ever have. FK stands for Forward Kinematics, and is the collective transforms applied to a bone by every bone going up it's skeleton chain. IK stands for Inverse-Kinematics and is quite literally the opposite of FK. Affecting bones through IK allows us to alter bones higher in the skeleton chain in a natural way with lower bones. For example, moving an arm through IK would look like choosing the position for the hand, and then adjusting the rest of the bones in the arm to naturally put the hand bone in that position. There are several things to consider when creating these "natural" transforms, like picking a joint bone to pivot the IK bone off of, and deciding how much bones can stretch to meet their IK goal, but the main idea is that the bones will be adjusted to maintain the goal transform that you set for the IK bone. I was using IK to have the left hand match the right hand's bone space transform at an offset to create the effect of holding a rifle, but the more varied the player's movement states got (running, sprinting, aim offsets, etc.) the more I encountered "swimming". Swimming is the effect of a bone floating away from its IK targets due to the FK effects being applied onto the bone. This resulted in the left hand often sliding off the barrel of the rifle, and breaking the illusion that the player was actually holding it. The solution I found, offered by UE5, is virtual bones. Virtual bones are weightless, IK bones that you can add to pre-existing bones on your skeleton, that are not affected by the FK of any higher bones in its chain. After creating an IK relationship between the left hand and the right hand virtual bone, and the right hand and the left hand virtual bone, the illusion of the player solidly holding the rifle was achieved. This system still has at least one limit, in the way that bones can only stretch as much as you allow them, but that's a good thing. I've found that if you set a hardly noticeable stretch limit, and your bones still can't meet their IK goal, then the thing to do is edit the animation, and quite rewardingly, it should then work!

Leave a comment

Log in with itch.io to leave a comment.