Using the Unity Animation System

In the previous article, Working with Unity’s NavMesh System for Smart AI, we saw how to move a model using a waypoint system and the NavMesh Agent. In this article, we are going to animate the model instead of it sliding around.

To start, the model needs an Animator component added.

We need to create an Animator Controller and drag it into the Animator Component.

Double click on the GuardAC Animator Controller will open the Animator window.

In this example, I will drag on the Idle and WalkingAlert Animations, set the transition from the Idle to WalkingAlerted and back again.

Next, I am going to create a Bool parameter that will control when the animator controller transitions between the two animations.

Now let’s make use of this parameter in the transition. Notice we unchecked Has Exit Time.

Do the same for the transition from WalkingAlert to Idle but set the Walk condition to false.

Now, all we need to do is call the animator in the script and set the Walk parameter at the right moments when the guard is moving during the waypoints and set it to Idle when pausing at the endpoints.

As you can see below, the model now switches between the Idle and Walk animations.

If you enjoyed reading this article give me a Clap, also if you would like to see more, “Follow” me, so you may be notified of future releases. You may also send me a message if you need any further help.

A Data & Analytics Consultant who is expanding into developing experiences in XR, Enterprise and Gaming space using Unity www.jeannoelseneque.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

All About Kotlin Multiplatform Mobile- KMM

Apache Kafka Tutorial: Getting Kafka Up and Running

How and why to use Laravel Homestead for local development — real life TIPS

Golang Tips #1 : ADT part 1

Ubuntu Install Nokogiri

Algorithmic Analysis

Liqwid Launch Timeline

How to Rice MacOS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jean-Noel Seneque

Jean-Noel Seneque

A Data & Analytics Consultant who is expanding into developing experiences in XR, Enterprise and Gaming space using Unity www.jeannoelseneque.com

More from Medium

How to Make the Camera Shake Using Impulse Listener Extensions in Cinemachines Virtual Cameras

VR Development — Day #2

Animating Sprites In Unity

Adding another powerup — Shields