In SAT collision detection how do I calculate the axes for projection?
We'll initially stick to 2D collisions detection for simplicity. (I'll discuss 3D at the end).
The axes used in SAT are the normal vectors of all of the edges of the two objects being considered.
Consider the box in this diagram;
The box has 4 edges: AB,BC,CD & DA (if using the clockwise convention). Each of these edges can be written as a vector;
I'll do a numerical example;
For SAT we need also to find normalBC, normalCD and normal DA. We also need to find the normals to all the edges of the other object in the collision detection.
All these normals are the set of axes which we will project both objects' vertices onto.
In some tutorials you will be advised to normalise the axes. this is not necessary, although I find it does make visualising the process easier.
Note, in the diagram, normalAB is parallel with normalCD in this case the result of projection on these axes will be the same (overlap or non-overlap) will be the same so there is no need to project on to both of them. You can eliminate normal CD. Similarly normal BC and normal DA are parallel, so you can eliminate one of these.
For 3D you will need to find the normals for all the faces, you will also need to get the cross product of all the edges of one object with all the edges of the other.