[If it's helpful to know,] for the contact normal I'm simply using the direction from boxB to boxA (unless one object is the ground, in which case I use the grounds normal). This is possibly incorrect but it is only particle physics being used here so complete 100% accuracy isn't a necessity.
Also, I've read up on the separating axis theorem but I was wondering if this may be slightly overkill for strictly AABBs since it can seemingly be applied to many generic polyhedra.
The only bit of information I need at this time is the overlap/penetration depth.
Here's what I have come up with so far (note: I quite often try to solve the 2D varient first since it'll be easier and then see from that how I can possibly extend it to 3D):
So possibly something along the lines of:
float dx = abs(boxA.min.x - boxB.max.x); float dy = abs(boxA.min.y - boxB.max.y); float dz = abs(boxA.min.z - boxB.max.z);And then possibly the penetration depth is the smallest of these three? (and then the two objects are pushed apart by this distance in the direction of the contact normal although what % of the penetration depth each object moves by is determined by the mass of the objects, heavier objects don't get pushed as far etc).
I'm likely nowhere near correct but it's starting to drive me cuckoo