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.