Preliminary solution to collision detection error [buggy]