Easiest way to draw a laser?

I’ve been looking around and I can’t find anyway to draw a laser.
I want to draw a textured line (trails/laser) from a Player’s Head to where they are looking.
I’ve opened some examples such as Spiderman’s SWEP and it looks really advanced.
What is the easiest way to draw a line? I don’t want the line seen through walls and it can’t be animated.
I’m thinking it might be best serverside since I’m trying to make a laser shooting SWEP (from the head to where they are looking).
Anyone got any ideas?

Here’s an example I posted not long ago: http://forum.facepunch.com/showthread.php?t=1348923&p=44645896&viewfull=1#post44645896

Granted; it shows how to use the beams to create cubes, but there you go. They can’t be seen through the walls either.


local MAP_ZONES_LASER = draw.GetMaterial( “cable/redlaser” );
local MAP_ZONES_POINTS = draw.GetMaterial( “cable/blue_elec” );
local MAP_ZONES_POINTS2 = draw.GetMaterial( “cable/hydra” );
local MAP_ZONES_POINTS3 = draw.GetMaterial( “cable/crystal_beam1” );


Thanks! But how do I make them so they can’t be seen through walls? I currently have this:

local tr = v:GetEyeTrace()
local pos1 = tr.HitPos + tr.HitNormal
local pos2 = tr.HitPos - tr.HitNormal

What hook do you use to draw the beams?


No, that’s not correct hook to use. Use PostDrawTranslucentRenderables, without the cam.Start3D() stuff.

Okay. Is that clientside?

Obviously, all rendering hooks are clientside.