I am attempting to implement the separating axis theorem in C#. I have a function that can calculate the minimum translation vector between two polygons. However, I can't seem to create a function that calculates the minimum translation vector between one polygon and multiple other polygons. Honestly, I've been working on this for months and am no closer to a solution and have not been able to find a solution online. There's always a few edge cases that do not return the correct result, leading to high priority bugs in my game.
Here are common edge cases that do not work correctly:
Is there a well-known solution for this problem? All I can find is people saying "just perform the SAT on each polygon" but this rarely produces the minimum translation vector.
Any help would be highly appreciated.