It must be another problem. Because I have changed those parameters and sometimes it works and other times it doesn’t. And without touching anything.
(I think it’s because I have other objects in the scene with collisions, and maybe the ray collides with one.)
By the way, I must have another version of that Script, in my version the field to set the “Main Camera” doesn’t appear, what exactly does that value do?