Box2d platformer and slopes

I've been searching on this subject for weeks now and I also implemented very rudimentary collision detection. However it's not perfect because the player jumps slightly in the air when going up/down slopes or when reach the top of the slopes.

My implementation is:

1. Player is a unicycle with the wheel having very high friction and just 1 density
2. When player is moving, determine if player feet collided with slope
3. If yes, turn off the player's gravity scale and set his linear damping to a high number
4. If player leaves slope, turn on gravity scale and reset linear damping

Now I was thinking that maybe it would make more sense to cast 3 rays downwards (player left, center, right) and check if they are hitting a slope/horizontal terrain.

But then, what should I exactly do with the information returned from the callback? How can I improve my implementation above?
cryo75 wrote:
...the player jumps slightly in the air when going up/down slopes or when reach the top of the slopes.

Seems pretty realistic to me - otherwise we would not have any 'extreme sports' 🙂

Unfortunately, I think the only way to avoid this properly is the way it is done in real life - as you approach the top of a slope, if you don't want to launch off it you slow down a little.
So (again unfortunately) it would require quite some sophisticated look-ahead system, possibly using raycasts as you suggest, to detect where the player should be slowing down.

Original thread: https://box2d.org/forum/viewtopic.php?t=9962