I'm building a simple 2D character controller based on raycasts. At this moment I'm trying to finish the player-ground interaction. For the ground I will be using edge colliders and no tiling information.
I have most code working but there's something I don't really know how to fix. Here is an screenshot explaining the situation:
As you can see, Player (purple rectangle) is on a slope. When player wants to move right the new x and y coords are calculated to set the player feet again on the slope (Blue rectangle). But, after this response has been applied to the player to make it out of the slope, It is pushed through the roof and some part of it is sticking out the edge collider (red box).
How do you handle this situation?
On the other hand, If there's any way to accomplish this in a simpler fashion I'm all ears :).