Top Down Line Trace

I understand the solution, but I just got back to developing. How do I get the camera distance from the surface?