I am using Separating Axis Theorem to check whether two polygons (player and object) intersect. I want to make the player bounce off the object, but to do this I need the side (from which I will calculate the angle) that the player collided with.
How can I get this from my SAT function?
When you calculate all your axis, in fact you get all the normals and so the sides.
You have to rotate all your axis by 90° an save whichpair of vertex give you the axis /normal.
So if the minimal overlap is on your axis[x], the side has a normal vector of rotate(axis[x],90).
And you have to project the vector between centers of yours objects on the minimal overlap axis, if the result is under 0 you have to take the opposite normal and vertex associated.
Note : In the case when you calculate your axis, left to right, otherwise you have to use -90°