more precise edge detection with raycast