Menu

Tutorial #5: Mechanim Animations

This tutorial expands on tutorials #1, 2, 3.  We will be adding mechanim animations to our bots.

In this tutorial, you will learn:

 

IMPORTANT! The animations included in this package are for prototyping purposes only! We converted the Unity’s free animations from the Unity 3 bootcamp sample project for use in humanoid models.  We don’t believe those animations were meant to be converted to humanoid, which is why they look strange (especially the walking and melee animations).  This is not a problem with our AI system.  Whether your bot acts strange or normal depends on the animation data being fed to it.  So as soon as you replace the animations, you will notice a difference. There are lots of nice and free animations on the Asset Store.

 

STEP 1: Let’s replace our cube models with the Unity Robot Kyle model (or any humanoid model).  Note, you must use the raw Robot Kyle .fbx model, without any colliders or scripts or animators.  The model must be set to Humanoid Rig to be compatible with our out-of-the-box animations.

1

2

 

STEP 2: Drag the raw model’s avatar into the bot prefab’s Animation Avatar slot

3

 

 

STEP 3: Select the default Animator Controller we already set up for you

4

 

 

STEP 4: You’re done!  Now play the scene. If you did it right, the bot should now be animated.  You can try doing the same on the enemy bot.

 

ADVANCED ANIMATION CONTROLLER: We have pre-built an advanced animation controller for you to instantly drop into your project and use.  This animation controller uses Avatar Masks to animate the lower body (running/walking) separately from the upper body (shooting, throwing, melee attacks).  This allows the bot to run and shoot at the same time.  If you are a beginner user, this might seem complicated.  Don’t worry, all you have to do is replace the animations!

5

6

 

 

CUSTOM ANIMATION CONTROLLERS/NAMES: What if you want to use your own animation controllers or names?  In the bot FSMs, any FSM state that has a comment like “[Animations]” means that state contains animation names for you to edit.

7