Easiest way to draw a line clientside?

What functions are the best to make a quick line? I’ve tried render.DrawBeam but I can’t seem to get it working.

Depends, what flavor are we talking? 3d or 2d?

You need to do it in a 3D rendering hook, such as PostDrawOpaqueRenderables. This is some code I posted in another thread.

[lua]local mat = Material(“cable/redlaser”)
local col = Color(255, 255, 255, 255)
hook.Add(“PostDrawOpaqueRenderables”, “test”, function( )
local v1 = Vector(0, 0, 200)
local v2 = Vector(100, 100, 400)
render.SetMaterial(mat)
render.DrawBeam(v1, v2, 5, 0, 0, col)
end)[/lua]

http://img267.imageshack.us/img267/1158/beam.png

If it’s for debugging the absolute easiest way to do it is debugoverlay.Line(pos1,pos2). That’ll draw a white line from pos1 to pos2 which will last a second. There are other parameters, so check the wiki out.
The debugoverlay library is very useful for that sort of thing. :>

Lexic, is that you in your avatar?

What type of line are we talking about here. A laser line like the slam laser? Or a line that would draw a crosshair on the screen?

Wearing a santa disguise, yes.

Well, i’m going to use the line to point the direction of the players aim at all times, I’m hoping for a 3d line but whatever works.

In which case, you’ll want a render.DrawBeam in a hook such as the one shown above.

Okay thanks.