Use your mouse and if you want then you can use my code by looking inside.
I made this by myself without tutorial but is inspired by the ray-tracing system I used in my most recent project which was not intentional. Anyway, have fun.