Download

What is the best method to attach weapon onto hands but still allow some movements?

Hi, I am working with an animator who is new to ue4 for my project. I am familiar with aimoffset/animBP/statemachine/blendspace stuff, but I do not have much experience with virtual bones and IKs. My character uses UE4 mannequin. My weapons(mostly guns) are separate skeleton mesh. They have their own animations for mechnical motions(for example, bolt open/trigger pulled). I am wondering what is the best workflow for making the weapon follow hand movement. There are a few I can think about but I can’t decide which one is the best.

  1. bake the movement of the entire weapon into animation data. Export weapon and body animation separately with the same root position. So in UE4 the gun and character move completely independently. That’s the way I choose for first person animation. However I imagine that would create some bugs when I make AimUp/Down offset, or use a character with slightly different height.
  2. From tutorials I’ve looked at, the simplest way is to directly create a weapon socket under hand_r bone and attach the weapon onto it. However it makes it impossible to perform certain tasks that require right hand to leave the grip(for example, right hands leaving the grip to pull charging handle).
  3. The other solution is to ask my animator to create a new bone under hand_r to act as a movable weapon bone, and animate weapon movement using that bone. So if needed this bone can temporarily leave hands for some special task, but stays with hand movements most of the time. However this means when importing animation I need to create a new skeleton rather than using UE4 Mannequin. This seems like the best solution so far but I hope to keep the ability to directly use any UE4 Mannequin character if possible.
  4. I’ve searched around and saw some posts mentioning using ik_hand_r and making this bone follow hand_r. But I don’t know how that can be done UE4? I am not quite familiar with IK bones in UE4 and I am not sure this is the right way to use IK bones here.

Thanks!

Well Epic’s IK bones is a bit deceiving and a better word use is auxiliary bones. A problem with animating in general is not all key frames from one app to another is the same and tend to float. Right hand generally hits the mark but the left hand will usually float around off the front stock when using a blend space (more so when using an aim off set.). IK bones do not seem to suffer from this problem as they generally have their own root nod so it’s always be relative to the gun stock so by using a 2-bone IK you can lock the left hand to the IK_lhand but still allow the aim offset, or any other secondary animations, to function with out floating. Rather basic stuff that your animator should be able to figure out and I would suggest using Epic’s IK bone set up.

The actual bone to link the weapon to is the IK_gun as it is a child of the right hand so lets say the weapon being used is a bolt action the IK_gun can be constrained to the left hand and the bolt operated with the right.

General information you don’t really need anything in the rigging set up to comply with any kind of UE4 requirement but if you are using Epic’s rig then there are some features and BP nods that will make thing easier.

As for doing animation I have a kit for our base character model that I’ll merge into the working scene. Normally the defalt position of a weapon or object be it SK or SM is relative to world origin of 0 0 0 so I’ll usually constraint a point helper at the same location. I’ll then relocate the weapon to the IK_gun, using the point helper, and then constraint to IK_gun.

Since I use Motion Builder I can now use the the auxiliary effector to move the IK_gun to any where that I wish and constraint the position relative to any joint.

Once I’m happy with the animation, say a reload that involves bolt and mag actions, I’ll plot the animations to the base, since I use MB, and snap the weapon back to it’s world origin, 0 0 0, and export the animations of the two as being unique. In UE4 if you combine the two, say with a character BP, you can then align the weapon to the character and when you play the animations for say the reload they will sync up.

Sry I didn’t fully understand that. How do you constrain the ik_gun to actual hand bones in editor? or you mean constrain ikgun to hand_r in modeling software and export the ik_gun movements to unreal?

Thanks for the reply anyway!