draw beam in the direction of motion controller

I was wondering how can I draw beam in the direction of motion controller?
Just like the picture below.