My take on jumping through ladders

The isClimbing bool get initialized as false although the first frame in Update() should do the trick anyway since if the Player is not touching a ladder isClimbing is always set to false in the first if statement.

I just added 2 if statements so the middle one is setting the isClimbing as true as soon as the player has a “climbing” input and the actual climbing code only gets executed if the player isClimbing …hope that makes sens but works for me.

So the Player character only interacts with a Ladder if you press up or down.

This was really clever! Thanks!

I found it worked great for keyboard, but I noticed that for a controller even the smallest Y-input would trigger the isClimbing bool as true (through the second if-statement.)

I therefore changed

moveInput.y != 0
to
Mathf.Abs(moveInput.y) > 0.25

That seemed to allow a decent amount of Y-movement/input on the analog stick before triggering the if-statement. The value (0.25) could be tweaked to ones liking though :slight_smile:

Privacy & Terms