Implemented collision detection/resolution with direction of collision