# 2D platformer:How to avoid “bouncing descend” when walking down slopes?

I've been working on implementing slope collision by SAT(Separating Axis Theorem). And then I have a trouble. When my character walks down slope, it moves like a bouncing ball:

The slope has 3 sprites (45°):

Here is my current code with JavaScript:

slopes.forEach((slope) => {
//Minimum Translation Vector
let mtv = character.collidesWith(slope);

if(mtv.overlap !== 0) {
character.velocityY = 0;
character.positionY -= mtv.overlap;
}
});


It works good when moving up, but bouncing when down, I have no idea how to keep the character stay on slope when walking down. Please, any help would be appreciated.

• What is "SAT" in this context? – Phrogz Aug 26 '17 at 13:58
• @Phrogz Sorry, that's my mistake, I mean Separating Axis Theorem. – undefined000 Aug 26 '17 at 15:00
• I solved similar problem by not relying only on gravity to keep the character on the ground but instead when close to the ground the character is instantly "snapped" at the ground level. Faster horizontal speed of course requires bigger snap distance. Another thing is that the first jumping "frame" must be bigger than snap distance. – Nikaas Sep 3 '17 at 0:49
• @undefined000 My coding skills are not exactly great so I doubt it would be of much use, but still next are the links if you can get something out of them (Unity component on C#) - CharCollisions - parent class with collision-check ray-casts, CharController - child class that moves the character. The main loop is CharController.Update() and CharController.FixedUpdate(). – Nikaas Sep 3 '17 at 19:48
• @undefined000 Next 2 links were very useful while a was making the character controller The hobbyist coder #1: 2D platformer controller and Platformer controls: how to avoid limpness and rigidity feelings – Nikaas Sep 3 '17 at 19:51