🔧Character Animation

In this section you will learn how to set up your animations

Step 1 - Import your animations

Specify the Generic or Humanoid rig. Bake the rotation and translation into the pose and specify the right avatar for your character.

Create a copy of your animation clip - we will need to make changes to it:

Copy and paste the animation

Step 2 - Animate the WeaponBone

Now we need to copy the animation data from the skeleton IK bone to the WeaponBone object.

chevron-rightWhy do we need to do this?hashtag

This approach doesn't require changing your skeleton at all, which will save you a lot of time. WeaponBone is a game object, automaticallt added by the system, and it's used for the IK and animation blending.

Open up the Transform Retarget tool:

A window will pop up

Select your animation as a Source and Target animation clip - that’s because we want to copy the animation data within one animation.

Now add your in-game and IK Rig characters to the scene:

Now assign the transforms as follows:

Click the Retarget Animation button

After that you shoulf see keyframes for the WeaponBone in your animation:

Step 3 - Modify the Avatar Mask

Unity won’t allow you to select a custom object like WeaponBone, because it’s not a part of the bone hierarchy.

For this go to the FPS Animator/Rig tab/Select your upper body avatar mask and click “Setup Avatar Mask”. Now your mask should have an extra property:

At this point the animation setup is complete. Create an AnimSequence for your animation and add it to the weapon, check if there’re any issues in the game.

chevron-rightAK12 AnimSequence Examplehashtag

These curves are essential:

  • MaskLeftHand disabled the left-hand ik.

  • Overay controls how the system overrides the upper body.

  • WeaponBone parents the weapon to the WeaponBone (by default it’s following the right hand, set the curve value to 1).

Last updated