In this recipe, we will use a more sophisticated method of aiming. This method is based on using several aim animations combined into a Blend Tree.
We are going to use the same assets as in the previous recipe, but instead of using the CharacterLookAt.cs
script, we will use additional animations: AimForward
, AimForwardUp
(aim 45 degrees up), AimForwardDown
(45 degrees down), AimLeft
(45 degrees left), AimLeftUp
(45 degrees left and 45 degrees up), Aim LeftDown
(45 degrees left and 45 degrees down), AimRight
(45 degrees right), AimRightDown
(45 degrees right and 45 degrees down), AimRightUp
(45 degrees right and 45 degrees up). See the following screenshot for reference:
Nine directional aim animations
You can also use the provided example Unity project and go to the Chapter 06 Handling combat\Recipe 09 Using blend trees to aim
directory. You will find an Example.unity
scene there, with a Humanoid
character. Play the game to see the effect. You can find...