I have a 3d moving box and a stationary box. I can detect collisions ok but now I would like to slide the moving box against the stationary box as a collision response. For this I need the normal of the face that collides with the moving box. Does anyone know how I figure this out? It doesn't seem like the collision test gives me this information. Any help is appreciated.
In order to calculate the normal to a plane (the collided AABB face) you need:
This will produce a vector perpendicular to this plane (but a plane have 2 sides).
Here is an example of how to calculate the cross product.
Let A, B, C and D be the four points of your AABB collided side.
If we use ABC, then the normal to the plane is
(it's just because our example is facing the screen, if the plane is seen from left side, the fist normal will point right and the second will point left)
As you can see the order in which you take the points will impact the side the normal will point to. That's why developers usually store their points in a specified order (clockwise or counter-clockwise, but the same for all faces) so they know in which order to use them.
See this on more details now:
Here is how to get the first normal
And here come the second normal pointing to the other side
If you replace the ABx, ABy, ABz etc. values with the differences calculated just before (Bx-Ax, By-Ay, Bz-Az etc.) the cross products you will get the normal vectors.