Creating a Ladder System in Unity — Part 1: Climb Ladder
Make character reach other platforms with ladders
Objective: Create a script to make the player able to climb a ladder.
The first step is to have some game object to use as a ladder in the scene, in this case I downloaded a ladder platform from filebase.
Then I created a new cube as a child of the platform, set the collider as a trigger, and created a new script to detect the collision with the player and start with the climb ladder mechanic.
In the player script I created 2 methods, climb ladder is to set the player values when it reaches the ladder and calculate ladder movement allow us to move the player across the ladder when the user presses the movement keys.
Next in the ladder system script, by using the function OnTriggerEnter we check for the player tag and call the Climb Ladder function.
And we have the first step ready, now the player can start climbing the ladder, but still needs to leave it. In the next article I’l show you how to do that.