I'm writing a physics simulation in Ogre3D and I'm trying to figure out how to calculate the collision normal between two Ogre::AxisAlignedBox's.
I am checking for collisions using the "intersects" function then calculating the collision normals as below, but I am almost certain that this is where I am going wrong as my collisions are very unpredictable:
Ogre::AxisAlignedBox intersection = boxA.intersection(boxB); Vector firstCollisionNorm = boxA.getCenter() - intersection.getCenter(); Vector secondCollisionNorm = boxB.getCenter() - intersection.getCenter();
After this, I am normalizing the collision normals, calculating the impulse magnitude using dot product, mass and relative velocity, then I multiply the collision normals by the magnitude to get the final impulse force vector, which is added to my current force vector as "impulseForce / deltaTime" for the next step of euler intergration.
If anyone could help me out I would greatly appreciate it!