Added directional collision detection.