Ray collision results in infinite distances

Short answer: no

Long answer: yes, if you reimplement it all yourself then anything is possible.