On the last 2 days, I have started on building a new game. This will be the first game I am going to publish (hands crossed) — and I hope I will be sharing some progress reports soon enough. Anyway, back to the AR Application.

If you are not familiar with my recent updates, I was working on a AR application in which we you can check my previous articles on it. You can check my previous articles for more information regarding the application.

Now, it is time to bring our horse model in! As the target image, I have dragged the ready Horse asset. The viewing transitions from horse to muscle and then to bone will be controlled by using Animation. The transition animation from horse to muscle and from muscle to bone were already ready. In order to create the transition in reverse (from bone to muscle and from muscle to horse), we have simply duplicated the original ones and changed the speed variable to -1. By changing the speed variable to -1, we simply tell the Animator to play the animations in reverse.

For transitions from each state to another, we could use trigger for each transition as below:

However, this is not the best practice. Imagine the scenario where you have tens of state and transitions, it will be hard to handle it, right?

Rather, we can assign an integer value for each state by using a single int parameter. As can be seen below, we have created the same functionality of transitions by only using one parameter.

In order to control the observed part from the application, we have inserted two buttons. These buttons will simply enable us to switch in between different view options (Horse, muscle and bone).

To control the buttons, an UI Manager script is created and filled as below:

Works like a charm. I believe one shot of me and the horse is enough for this article, so I am not posting the shot playing the animation with me :).

Unity Developer