# Hand IK with different grips

**URL:** <https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018>\
**Category:** C++\
**Tags:** unreal-engine, CPP, question\
**Created:** [September 30, 2023, 7:21pm UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018 "2023-09-30T19:21:06Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Awesomeplayer895](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/awesomeplayer895/32/734830_2.png) [@Awesomeplayer895](https://forums.unrealengine.com/u/Awesomeplayer895)\
**Post date:** [September 30, 2023, 7:21pm UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/1 "2023-09-30T19:21:06Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [October 1, 2023, 4:17am UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/2 "2023-10-01T04:17:44Z")

</div>

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.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/8/0/c807c3bb7cb614071574faee0cedab1fa46da611.png)

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.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/a/3/3a36a616b5ea6fcc5f71399f27c3a132fc0b2a91.png)

- 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:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/6/a/b6af3014926b5c54c67626364f8e59ab2181bd78.png)

Hope that points in you in the right direction.

---

<div class="post-metadata">

**Author:** ![Awesomeplayer895](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/awesomeplayer895/32/734830_2.png) [@Awesomeplayer895](https://forums.unrealengine.com/u/Awesomeplayer895)\
**Post date:** [October 1, 2023, 4:33am UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/3 "2023-10-01T04:33:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [October 1, 2023, 4:41am UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/4 "2023-10-01T04:41:19Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [October 1, 2023, 6:24am UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/5 "2023-10-01T06:24:14Z")

</div>

Which runtime calculations are you referring too?

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [October 1, 2023, 7:42pm UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/6 "2023-10-01T19:42:01Z")

</div>

The example you gave is all calculated at runtime.

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [October 2, 2023, 5:17am UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/7 "2023-10-02T05:17:52Z")

</div>

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.

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/4/e/44ed0826d03be50c10a1757584ed6453f33f6e97.jpeg "GROUND BRANCH GRIPS") ](https://www.youtube.com/watch?v=M1k6Jn-lXhQ)

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.

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [October 2, 2023, 10:12am UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/8 "2023-10-02T10:12:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [October 2, 2023, 1:00pm UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/9 "2023-10-02T13:00:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [October 2, 2023, 8:29pm UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/10 "2023-10-02T20:29:38Z")

</div>

> [@Kris](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![Awesomeplayer895](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/awesomeplayer895/32/734830_2.png) [@Awesomeplayer895](https://forums.unrealengine.com/u/Awesomeplayer895)\
**Post date:** [October 3, 2023, 2:28am UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/11 "2023-10-03T02:28:48Z")

</div>

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”?

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [October 3, 2023, 6:48am UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/12 "2023-10-03T06:48:50Z")

</div>

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.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/2/b/52b01037eb5dd10fadabf43e20c2ea8ec955d3dd.jpeg)

---

<div class="post-metadata">

**Author:** ![Awesomeplayer895](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/awesomeplayer895/32/734830_2.png) [@Awesomeplayer895](https://forums.unrealengine.com/u/Awesomeplayer895)\
**Post date:** [October 4, 2023, 5:47am UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/13 "2023-10-04T05:47:04Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![dissCorrupt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dissCorrupt](https://forums.unrealengine.com/u/dissCorrupt)\
**Post date:** [November 21, 2024, 3:57pm UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/14 "2024-11-21T15:57:33Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [December 3, 2024, 5:15am UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/15 "2024-12-03T05:15:51Z")

</div>

As mentioned in an earlier post:

> [@Hand IK with different grips](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/2):
>
> 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 …

tl;dr - curves

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [January 20, 2025, 8:46am UTC](https://forums.unrealengine.com/t/hand-ik-with-different-grips/1318018/16 "2025-01-20T08:46:18Z")

</div>

Going from the ground up.

Weapon class with Grip definition \> which holds a single frame animation defining how it’s held.  
Also drines the reload animation.  
And has an interface for usage.

Likewise  
Grip class with deicated definition \> holding whaever single frame animation the grip you instance within the weapon will utilize.  
And has an interface for easy access.

You then create the instance of the weapon from class, and the instances of the grips from the grip class.

Then within the weapon you add clildBP of the instanced grip.

Then you use Interface Calls to simply have the info you need used by the montage or the ABP.

You can go pretty complex, but its at most maybe 5 days of work to set up a fully modular system you can easily re-use in any engine you want…
