I’ve got a weird issue with gravity in a platformer I am working on. When the player is on a ladder and not pressing up or down, I want them to just stay in place. I’ve tried disabling gravity when a player is on a ladder, and I’ve also tried giving the player the negative amount of gravity to counteract the global gravity. In both cases the player slowly slides down the ladder. It’s as if there is still a tiny bit of gravity left?
Here is a codepen of the issue:
And one where I’ve ‘fixed’ it by setting:
On line 449
setting that value to -5 instead of 0 stops the player sliding down. I just can not for the life of me work out why that number needs to be -5? Any help or insight on this is greatly appreciated.