When a player collides with a block, I move them based on the smallest axis change, which makes sense.
However, this gets confusing when many blocks interact with each other.
From this example, the player obviously should move up, but the boxes individually have different viewpoints
How do I know which box is "correct"?
The solution is to find the closest blocks for X and Y
In this situation, the Red block is closer on the X axis, so it should be used to fix the Y axis
Also, to prevent a block from moving the player to a corner, add a grace buffer. In the image below, the purple and green areas are slightly smaller then the size of the player.
If a block is the closest on one of the axes, and it is in that area, then it should be used for collisions