Original Post
I am currently attempting to write AABB to moving circle collision detection and response in 2D. There is a single moving circle, which most likely has a changing velocity each update, and there are multiple AABBs which the circle is not allowed to move through. The code checks for collision between the moving circle and all of the AABBs that surround it (up to 8). If a collision is detected, the time of collision is calculated using an extended AABB with rounded corners and a ray from the circle's starting position to where it ends up. The circle is moved along the ray to the time of intersection. However, this collision detection system is flawed because the circle is now at the time of intersection which means that it is still intersecting the AABB. So the circle is moved back by an additional 1 pixel (not circular, meaning the magnitude of the vector the circle is additionally moved back by might not be 1). Even this system does not work correctly though. If the circle's movement vector is parallel to an edge/face (this is 2D, so I am unsure which term to use) of the AABB, the circle could be within 1 pixel of the AABB and not be pushed back. To make the response code a bit cleaner, the movement vector that is used is extended by 1 block pixel. This way the "additional" move-back is not required as it is part of being pushed to the point of intersection. This does not solve the previously mention problem however. Here is a graph showing the problem:
If anyone could help, I would greatly appreciate it!
If anyone could help, I would greatly appreciate it!