In this section you will find out how to set up the animation blueprint
Step 1 - Add Virtual Bones
To get the system working, you need to set up the IK system. The idea is simple - hands IK targes are parented to the WeaponPivot bone, which is modified by the recoil. As a result, arms will be animated.
The bone hierarchy is the following:
VB WeaponPivot -> targets head bone
VB hand_r -> targets right hand
VB hand_l -> targets left hand
Tip: make sure that the head/neck bone is not scaled! This might happen when you "hide" the head mesh by using the SkeletalMeshComponent function HideBoneByName - it will reduce the scale of the bone, which will lead to incorrect results!
Solution A: parent the VB WeaponPivot and its children to the root bone.
Solution B: if you need to hide the head bone, try using an invisible material for it.
Step 2 - Retarget Bones
Add these nodes at the end of your animation blueprint:
Node settings:
Example
For VB WeaponPivot select the hand_r as a Source bone, we will fix it later so it's aligned with the weapon's physical pivot.
Step 3 - Add Recoil Node
Now you need to add the RecoilAnimation node after the retargeting nodes:
This node will automatically apply recoil
Node settings:
Bone to Modify - bone to be modified by recoil.
Axes Order - defines how recoil axes will be applied. By default, the recoil uses XYZ order.
Translation/Rotation Scale - multipliers for each rotation/translation axis.
Translation/Rotation Space - similar to Transform Modify Bone.
Translation/Rotation - recoil values. Only used when Use Auto Update is false.
Select the VB WeaponPivot, Component Space, and YXZ order.
Why YXZ order?
If you use Epic Skeleton, then in Component Space Y is the forward, X is the right, and Z is the up axis - this is different from the standard XYZ order, so recoil won't be applied correctly.
Step 4 - Add IK Nodes
For IK you can use FABRIK or Two Bone IK nodes - there's no a big difference. Let's use Two Bone IK in this example:
Add these nodes after the Recoil node
Select hand_r as an IKBone, and VB hand_r as an Effector Target:
IK node settings
At this point the animation setup is complete - now it's time to find out more about curves and how recoil works.