Creating Coin Distraction Feature in Unity (Part 5: Adding Throw Animation)

Objective: add the throw animation to the player and trigger it when the player tosses a coin.

First I created a Throw trigger parameter in the player animator.

Then I set the transition between all animations. From any state we can go to throw animation and depending on the value of the walk parameter we activate the walk or the idle animations.

In the player script, when the player make right click to instantiate the coin I added the function _animator.SetTrigger(“Throw”), this function changes the value of the trigger parameter and activates the animation.

And that’s it!!! Now you can see how the player throws the coin.

--

--

--

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

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

Recommended from Medium

Deploy your Joomla app with Heroku

GitHub for Everyone

Windows 11 | Targeting needs of Developers

Remote Learning During the Coronavirus Outbreak: How to Stream From Zoom to Thousands

A code style guide for OutSystems

The Significance of Building Offline-First Apps : Aalpha

2 CQRS Architectures that Every Software Architect Should Know

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
Rusben Guzman

Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

More from Medium

nitCreating Collectables in Unity

Cross-platform Input Controller in Unity

Modular Health System in Unity!

New Enemy Movement Behavior