Creating Coin Distraction Feature in Unity (Part 5: Adding Throw Animation)
Adding throw animation to player
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.