Creating a Ladder System in Unity — Part 2: Leaving the Ladder.
Objective: update the ladder system script to make the player able to leave the ladder.
For this example I added new animations, one for the climb ladder action and another for fall from the ladder.i In the animation controller these animations are triggered from any state and then go back to the idle state.
In the player script 2 other functions to set the values of the animators and flags when the player leaves the ladder and when is grounded.
In the ladder system script I created a conditional within the OnTriggerEnter function, if the player presses the up/down keys he is going to climb the ladder and if he presses the left/right key he falls from the ladder.
And that’s it!!! Now the player can leave the ladder at any moment.