Climb Ladder Implementation

Hi

In attempting to solve the problem myself and take on the challenge, I first attempted to copy the Jump command whereby I added the new velocity from keydown to the players current rigidbody velocity. This didn’t work at the time but now I think this is because the keydown additional velocity by itself would be too slow with out a climb speed multiplier to overcome gravity. Am I correct in assuming this?

My second attempt was to use the transform.Translate method in order to move the player character up by the Y position, which immediately snapped the character down. For this I believe the movement was too small for a single key press whereby gravity snapped it down again. Is this line of thinking correct?

Finally could either of these methods be used for climbing? I’m wondering why the adjustment to rigidbody.velocity is the selected method and how this is better than simply transforming the y position of the player up or down.

Hi,

To make the player climb, the force which moves him up the ladder must be higher than the gravity pulling him down. However, whether your assumption is correct, is impossible to tell for me, because I don’t know the actual situation in your game. The “up” velocity could have been higher than the gravity. You’ll have to test everything to figure out whether your assumption is correct.

Same for your second idea. Without knowing what happened, it is impossible to tell whether your assumption is right. If you called transform.Translate() only once, maybe in Start(), it makes sense that the player never climbs. You’ll have to log values and messages into your console to understand what’s going on during runtime, and based on what you figured out, you will be able to evaluate your assumption.

Both your approaches sound fine to me, and, theoretically, they should work if implemented correctly. Analyse the situation in your project to figure out why your idea did not work as expected. Then you’ll certainly be able to fix the remaining problems. :slight_smile:


See also:

Awesome. Thanks Nina!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms