I've been looking for samples and tutorials, but I can't find anything specific.
I am making a 2D XNA C# Game and I want to detect the final position of the player when it reaches one or more path lines, so it won't cross them.
The player is made of a collision rectangle, the path lines are all segments. So basically I have the player's collision rectangle and the next player's position collision rectangle. If the next player's position collides to path lines, I want to find the maximum displacement the player can suffer.
The image shows more or less what I want to do:
I want to find the position of the red rectangle.
Does anyone have any algorithm, solution or any link that could help me? Could be even a sample.