I am working on a collision system in a Platformer tile-based game. All tiles are AABB.
I am trying to implement "Rewind to Moment of First Intersection" mentioned in this post's second point.
The following case is to be considered:
Without vectors for clarity:
With vectors:
I am trying to find the vector \$\vec{w}\$, which is the vector \$\color{red}{\vec{v}}\$ multiplied by a factor \$f \in (0, 1) \$. All other vectors are known.
\$\color{red}{\vec{v}}\$ represents the reversed movement (or velocity) vector between current and previous frame, whereas \$\vec{w}\$ represents \$\color{red}{\vec{v}}\$ scaled in such a way, that translating the player object over \$\vec w\$ leaves the player in the moment of first intersection.
\$\color{green}{\vec{a}, \vec{b}}, \color{blue}{\vec{c}, \vec{d}}\$ represent the penetration depths of colliding objects on corresponding horizontal/vertical axises.
Tiles' width and height is also known.
Assuming that tiles are AABB, strictly-aligned, immovable and all share the same width/height - how do I find the vector \$\vec{w}\$?
Seeing pseudocode would be awesome.
I am also having surprisingly hard time finding any collision solving learning materials that would suit my needs; if anyone knows such materials, I would be thankful for sharing.