Implements real collision detection.