Skip to content

Instantly share code, notes, and snippets.

@MondayHopscotch
Created October 7, 2015 03:14
Show Gist options
  • Save MondayHopscotch/b7283d45b752eca18ac5 to your computer and use it in GitHub Desktop.
Save MondayHopscotch/b7283d45b752eca18ac5 to your computer and use it in GitHub Desktop.
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