Horse Anatomy AR — Animator Logic

David Brown
3 min readJul 14, 2022

--

Objective: Animating our horse to transition into the different anatomy states.

Now that are project has AR functionality, let’s talk about how this app is supposed to work. We want to control the animations of the horse by using buttons. We of course can’t do that yet until we setup the animator.

Setting up the Animator

First, I created an animator called Horse. Then I created an empty state and named it Default. This will be the default animation that plays.

Then I added the two animations that we’ll use in the project.

To setup our transitions we need to understand how the horse is supposed to animate.

Let’s look at the first animation. The first one transitions from the base horse model to the muscle anatomy model.

The second animation transitions from the muscle anatomy to the skeletal anatomy model.

But I also want the ability to do the reverse. If I’m in the muscle anatomy I should be able to transition back to the base model. If I’m in the skeletal model, I should be able to transition to the muscle anatomy model.

All we have to do is duplicate our animations. Then in the speed variable, change the speed value to a negative value to play the animation in reverse.

Transitioning Between Animations

Now that we have all of our animations in place, we can start transitioning between those animations. Let’s start by making a transition from the default state to the fade horse to muscle state.

Then I created a trigger parameter. When this trigger gets called and the animator is on the default state, then it will transition to the fade horse to muscle animation.

I repeated these steps with all of the animations and created trigger parameters to transition between them.

However, this way isn’t modular and can become a nightmare to maintain if there were more animations. Instead, we change the animation state based on an index value.

Optimizing The Animator

This is what the animator looks like using an index-based parameter.

When the NextAnim integer is at one, it will transition into the muscle anatomy model. If NextAnim is at two, then it will transition into the skeletal model. Finally, if NextAnim equals zero, then it will transition into the base horse model.

As you can see this is way more optimal then using a bunch of trigger parameters.

Thanks for reading! In the next article we’ll create the UI Manager to change the animations through code.

--

--

David Brown

I like pizza, cream soda, and making games with Unity