It is possible that you are using the raycast correctly, there are times where I've experimented with coding and it never works, and then I see a member on Cyberix actually come up with the same code and they publish it working.
It could be that the Cyberix engine is glitched depending on the user, or that I'm using Firefox.