I have spent hours looking for the solution to this: I am developing a little top-down game with libgdx (maybe it matters what engine i am using). Now i have to implement the collision detection between my character (circle) and the wall (rectangle). I want the character to slide along the wall on collision, if sliding is possible.
Let me explain:

> 
> * If i am moving 45 degrees right up i can collide with the down, the
>  left or the corner of a wall.
> * If i collide with the left i want to stop x-movement and move only up. If i leave the wall then i want to go on moving right up. The same
>  with the down side (stop y-movement)
> * If i collide with the Corner i want to stop movement (sliding not possible).
> 
> 
> 

What i am doing actually is to check if the left line of the rectangle intersects my circle. Then i check intersection between the left line of wall and my circle and the bottom line of wall and my circle. Depending on which intersection occuret i set back x/y possition of my circle and set x/y Speed to 0. The Problem is, that most times not a **collision** bt an **overlap** occures. So the bottom check returns true, even if in reality the circle would only collide with the right. In this case both intersection test would return true and i would reset both speeds like on the Corner collision.
How can i solve this Problem? Is ther a better way to detect collision and collision side or corner?
I don't Need the exact Point of collision just the side of the rectangle. 

**Edit:**
I have to say, that the rects aren't rotated just parallel to the x-axis.