i fixed the YT vid link. Edit the post to view the proper code to use, there.
otherwise, my hunch is that you're using screen coordinates somewhere vs world coordinates. see ScreenToWorldX
/Y() concerning the use of SetViewOffset
Draw is going to work as expected but your Ray, for example, needs World Coordinates to be accurate.
i only briefly skimmed your code and i do see:
and still feel your using World Coords where proper will resolve the issue.