Well the code snippet I provided takes the camera angle and displays a particle beam into that direction.
So if you work on a 3rd person shooter this might not be the case.
In this case you would have to find another way to calculate the direction of the laser.
So as long as you don't give more information about the environment in which this laser is supposed to work, I cannot help you any further.