Created
October 7, 2015 03:14
-
-
Save MondayHopscotch/b7283d45b752eca18ac5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allCollisionAxes.sort((axis1, axis2) -> Float.compare(Math.abs(axis1.translationVector), Math.abs(axis2.translationVector))); | |
Vector relativeMovement = body1.speed.minus(body2.speed); | |
float dotProd; | |
for (Axis axis : allCollisionAxes) { | |
dotProd = relativeMovement.dot(axis); | |
if (dotProd != 0 && !sameSign(dotProd, axisOver.translationVector)) { | |
resolutionAxis = axis; | |
resolutionDistance = axis.translationVector; | |
return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment