Download

Hand IK (for VR) and forearm roll

I’m developing a multiplayer VR shooter so arm IK is part of the animation requirements. It works pretty well at this point, but I’m now trying to add in first person arms to replace the default robot hands I’ve been using. So, I detached the arms from the third person mesh and set them as first person mesh that is only visible to owner. The first person mesh uses the epic skeleton and is simply following a master pose from the third person mesh. In first person, however, it becomes very obvious that the lower arms aren’t rolling properly. You can see it in the video below. In the video I am setting the bone space roll of the lowerarm_r to the worldspace roll of the controller… obviously this is wrong, but it works at certain angles. Before I was doing this the lower arm would just be rolled based on the elbow, which also looked wrong.

Looking at my own arms, the solution seems pretty simple; I want the back of the hand to match the top of the forearm, pretty much all the time. In code, though, I’m getting pretty confused. How could I calculate the proper bone space roll for lowerarm_r from just the target hand rotation? I have to imagine that this issue has been solved before and I’m just missing something obvious.

I’m running into this exact same problem! Been puzzling over it for a few days now, wondering if you found any solution?

You have a couple of options, but for both you’re also having some issues:

  • In the animBP, you can use the “Apply percentage of rotation” and set the multiplier to be 0.5
  • Use the “Copy Bone” node and set the alpha to 0.6
  • Use the Twist corrective node, and map the range accordingly

I always work with rotation using component space, so that you can choose the arm roll without any further issues.
On all 3 nodes, you’re going to have gimbal lock issue, since if you flip the arm too much, you’re having a situation where the degrees are going between ±180°, and you’ll see the forearm flipping when that happens.
The solution is to use the control rig, which allows you to choose wuaternion ( aka complicated math ) to completely avoid any gimbal lock, so I suggest you to try that instead of the classic AnimBP.