Adjusted ray picking logic to minimize offset.