Game Development Reference
In-Depth Information
Character animations
Animations are what bring the characters to life visually in the game. From basic an-
imations to super realistic movements, all the animations are important and really rep-
resent what scripters do to the player. Before we add animations to our AI, we first
need to get a model mesh for it!
Importing the model mesh
For this chapter, I am using a model mesh that I got from the Unity Asset Store. To
use the same model mesh that I am using, go to the Unity Asset Store and search for
Skeletons Pack . It is a package of four skeleton model meshes that are fully textured,
propped, and animated. The asset itself is free and great to use.
When you import the package into Unity, it will come with all four models as well as
their textures, and an example scene named ShowCase . Open that scene and you
should see the four skeletons. If you run the scene, you will see all the skeletons play-
ing their idle animations.
Choose the skeleton you want to use for your AI; I chose skeletonDark for mine.
Click on the drop-down list of your skeleton in the Hierarchy window, and then on the
Bip01 drop-down list. Then, select the magicParticle object. For our AI, we will not
need it, so delete it from the Hierarchy window.
Create a new prefab in the Project window and name it Skeleton . Now select the
skeleton that you want to use from the Hierarchy window and drag it onto the newly
created prefab. This will now be the model that you will use for this chapter.
In your AI test scene, drag and drop Skeleton Prefab onto the scene. I have placed
mine towards the center of the level, near the waypoint in the middle. In the Inspector
window, you will be able to see the Animation component full of animations for the
model.
Now, we will need to add a few components to our skeleton. Go to the Components
menu on the top of the Unity window, select Navigation , and then select NavMesh
Agent . Doing this will allow the skeleton to utilize the NavMesh we created earlier.
Next, go into the Components menu again and click on Capsule Collider as well as
Search WWH ::




Custom Search