collision detection foundations