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?
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?