In this chapter, we will demonstrate the implementation of basic facial animation with Mecanim. Mecanim's Humanoid animation type has a small predefined set of bones that will accommodate face animation. This can be layered within the animator controller, effectively separating body and face animation to be triggered under different conditions.
There are several valid reasons due to which we may want to separate out face and body animations—we want the player to be given a sign that the enemy has spotted them. We do not have a way of determining what state the enemy character is in when they spot the player. We do not want them to immediately attack, however, we want to give the player an opportunity to react before the enemy. After all, the enemy is a slow moving zombie.
In this chapter, you will be:
Preparing conditions in the scene to allow a triggered response
Updating the zombie's script to allow it to target and move toward the player
Implementing an audio asset...