Ok I'm to do find the solution for this for some time now.I have a capsule (player object) that moves on lines (the level map).I'm using the applyForce function to move the object on the X axis only (left and right).the issue is when I'm on cliffs and hard edges on the map the objects is flying off it and not sliding down.

in green you can see what I'm trying to do and in blue is what happens.

there is a function that will make the player stay on line when it moves?