How to do it...

To use the Blend Trees methods for aiming, follow these steps:

  1. Import your character with all the necessary animations to Unity and place it on the Scene.
  2. Follow the Using Avatar Masks and animator controller layers to walk and aim recipe to make the character walk and aim.
  3. Open the controller and go to the Aim Layer.
  4. Delete the AimForward state and create a new Blend Tree.
  5. Create two float parameters: AimVer and AimHor.
  1. Set the Blend Type to Freeform Cartesian.
  2. Set the first parameter of the Blend Tree to AimHor and the second one to AimVer.
  3. Create nine Motion Fields in the Blend Tree and assign all the aim animations to them.
  4. Set the Motion Fields as follows (also see the following screenshot for reference):
    • AimLeftDown ...

Get Unity 5.x Animation Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.