
13.4 Separating Axis Tests 319
contact->contactNormal.normalize();
contact->contactPoint = closestPtWorld;
contact->penetration = sphere.radius - real_sqrt(dist);
contact->setBodyData(box.body, sphere.body,
data->friction, data->restitution);
data->addContacts(1);
return 1;
}
13.4 Separating Axis Tests
The separating axis test (SAT) is one of the most useful concepts in collision detec-
tion, and will be the workhorse algorithm for the remaining contact generators in this
section. The SAT says that if there is any axis along which two objects are separated,
then you know those objects cannot be in contact. To perform this test we project the
3D objects