Hand IK with different grips

Hello all,

I have been doing some investigation into left hand bone IK so that I can adjust the left hand of my character to fit different weapons. However I have noticed that many of the tutorials online work, but only for holding the barrel of the gun or maintaining the original idle animation. So if I were to equip a vertical grip for example, the hand could change its position to be more in line with the grip, but it does not rotate to look like it is holding the grip properly. I was wondering if there was a way to modify the bone IK system to support different grips, or if I would just have to have different idle animations?

Thank you in advance!

In our case, we could not use a single additive pose, as we have multiple grips, firearms and the grips can be placed at different locations on a rail.

Preparation:

  • an animation curve to control when to blend in/out of the left hand override pose.
  • virtual bones to be use as parent-child - VB temp_root & VB temp_child1.
  • a generic grip pose for each grip, based on a base rifle pose - in our case, the AR-15.
  • predetermined offset from ik_hand_gun.

Animation blueprint:

  • use an evaluate node to play the generic grip pose.
  • copy ik_hand_gun location & rotation to VB temp_root
  • copy ik_hand_gun location to VB temp_child1
  • copy ik_hand_l to rotation to VB temp_child1
  • offset VB temp_child1 by a predetermined offset.

  • feed this into a layered blend by pose that is splitting off clavicle_l, ik_hand_l & VB temp_root.

  • copy ik_hand_gun location & rotation to VB temp_root

  • copy VB temp_child1 location & rotation to ik_hand_l

  • feed this into a blend node with the alpha controlled by the animation curve made earlier.

You may need to add additional nodes/logic to handle a pole vector for your left elbow, depending on your requirements. We do, as we have low ready and high ready positions to take into account.

Last thing you need to do is to remember to use the animation curve in any animation that animates the left arm to blend out/in of the grip pose:

Hope that points in you in the right direction.

1 Like

Yes this is a very big help! Thank you for this!

Go easier:
Custom weapon class which defines what animation to use.
Custom montage class that will play the required montage on a slot designated within the weapon.

That way no matter how you spin it you should always be able to have your underlying animations and a custom defined animated grip for each weapon - which is 100% reliable, compared to relying on runtime calculations…

Which runtime calculations are you referring too?

The example you gave is all calculated at runtime.

The offset is, as mentioned, predetermined.
In the case above, SetLeftHandOveridePose() is called by the grips equip function.

The copy nodes are not exactly demanding - they are copying the location and/or rotation of one bone to another.
Ditto with the offset node.

All the animation graph nodes are using Fast Path methods too.

The method described is far easier then having to create a custom pose for each firearm and grip combination. Far more flexible too, since the position of the grip does not need to be fixed to one place.

As far being reliable, been using it for years.

We have had issues relating to the left arm, but they are fairly typical of using IK - not the grip system itself.
i.e. elbow pole vector & over extension of the arm.

Doesn’t really change much;

The “proper” way to do it is with different poses.

If you want to fake it and incur the runtime costs of it, instead of using dedicated animations for it, then that’s your (or your srudio’s) buisness.

Epic does crazy fortnite only things too. Its not uncommon.

However, if the project was using dedicated animations you’d never really have any pole vector issues on that left arm to contend with.
Nevermind the fact you can proably easily fix it by swapping IK solver, or adding an invisible pole vector to the weapon.

There is also another thing to note:
Unless you set things up (and calculate) properly your IK is always one frame behind.

An animation (additive or otherwise) would never cause that. Though being far less dynamic.

We are using different poses for each grip - just not for each firearm and grip combination.

All this system does - after applying the generic grip pose set by the currently equipped grip - is compensate for the differences between the left hand in that pose and the current rifle.

The runtime cost of the copy nodes is pretty negligible.
The layered blend by bone, less so.
Both can be removed entirely via the LOD system for distance characters.

We are not incurring any additional costs with IK, since it already a requirement to correct for the displacement of the left hand caused by aim offsets, leaning etc.

One frame lag is non issue, since we are using a predetermined offset from ik_hand_gun to set the location ik_hand_l. Unless you change grips, there is no need to change this value at runtime, making it up to date, regardless of what thread the animation updates on.

Yes, creating a dedicated animation for each firearm and grip combination is an option, just not a practical one.

Take our game as example - 30+ firearms that support grips and 10+ grips.

No studio - even with massive funding behind it - would opt to create 300 animations when 10 poses and some IK would do the same job. And this ignores reloads or any other animation.

As for pole vectors, unless the only animation being played was one of these animations, then they would most likely be required.

Don’t count on that, with a proper mocap setup making 300 animations is trivial.
The fact you can avoid it and the result is similar doesn’t mean people wont do it.
Or more properly shouldnt do it.

In your case particulalry, swapping from a regular rifle stock to a vertical folding grip wouldn’t necessarily involve much of a pole switch (proper gun handling stance should cover both flat under and a vertical grip).

But imagine extreme cases like holding a spear or a two handed claymore… the Ik becomes effectively useless (and in fact its only really used to adjust from shoulder width differences in characters at runtime, since without it you could potentially not reach the handle).

Either way, different situation but similar solutions.

So if I am understanding correctly, this kind of system allows for me to have only one idle pose for each grip type, but then apply to every gun with different “grip points”?

Yeah.

Grips in our game are only compatible with bottom facing rails that have recoil slots within a certain distance to prevent over extension of the arm.

Oh okay. What is really appealing about this system is for someone like me who is not an animator, having only a few animations I need to use and then applying it to everything makes my life a whole lot easier!

1 Like

This is an older topic but I was wondering @Kris how do you handle reloads and other actions that use a different left hand poses?
For example a reload animation that would end up with a hand on rail at the end but you have a vertical grip with a different pose.
Since you are using IK’s to drive the pose of the grip to the correct position, how do you handle that?
Are you release the left hand earlier from the rest of the animation so that it blends into the grip pose?