Render.DrawBeam limit?

Is there some kind of limit on **[Render.DrawBeam

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Render.DrawBeam)**?

I’m writing some SEnts that use multiples Beams, and it seems to start breaking after about 10 are on screen.

The SEnt is a laser grid, each beam utilizing a Trace to kill the player on touch (For an obstical course gamemode).

Here’s whats going on…

Doing traces in rendering hooks CAN give very weird results.

Maybe its better to use at this point util.TraceHull and give its maximum height/width instead of multiple lines.

I’m not calling the traces on the client end, i’m doing so on the server under the Think() function.

I store the start and end vectors in a couple NWVec’s (which may be a bad practice, sorry) on the SEnt, then access them on the client side code (GetNWVector) to draw the beam.

I figure its a limitation of either the render library, Source, or Garry’s Mod. In that case, “damn.”

That or i’m doing something way wrong which is always a possibility.

[editline]4th January 2012[/editline]

Code-

Server:
[LUA]function ENT:Think()

for i=1,5,1 do
local pos = self:GetPos() - (self:GetForward() * 2) + Vector( 0, 0, self:CalculateBeamPosition(i * 0.25) + 75 )
local ang = self:GetRight() * -1
local trace = {}
trace.start = pos
trace.endpos = pos+(ang*self.Data.TraceDistance)
trace.filter = self

 local tr = util.TraceLine(trace)
 if (tr.HitNonWorld && tr.Entity:IsPlayer()) then
    self:HurtPlayer(tr.Entity)   
 end
 
 self:SetNetworkedVector("BeamDrawStart"..i, tr.StartPos)
 self:SetNetworkedVector("BeamDrawEnd"..i, tr.HitPos)

end

self:NextThink( CurTime() + 0.001 )
return true

end

function ENT:CalculateBeamPosition( offset )

local A = 75
local W = 1
local O = offset

return A * math.sin(W * CurTime() - O)

end[/LUA]

Client:
[LUA]function ENT:Draw()

self:DrawModel()

render.SetMaterial( Material( "trails/laser" ) )
render.DrawBeam( self:GetNetworkedVector("BeamDrawStart1"), self:GetNetworkedVector("BeamDrawEnd1"), 10, 1, 1, Color(110, 255, 255, 200) )     
render.DrawBeam( self:GetNetworkedVector("BeamDrawStart2"), self:GetNetworkedVector("BeamDrawEnd2"), 10, 1, 1, Color(110, 255, 255, 200) )
render.DrawBeam( self:GetNetworkedVector("BeamDrawStart3"), self:GetNetworkedVector("BeamDrawEnd3"), 10, 1, 1, Color(110, 255, 255, 200) )     
render.DrawBeam( self:GetNetworkedVector("BeamDrawStart4"), self:GetNetworkedVector("BeamDrawEnd4"), 10, 1, 1, Color(110, 255, 255, 200) )
render.DrawBeam( self:GetNetworkedVector("BeamDrawStart5"), self:GetNetworkedVector("BeamDrawEnd5"), 10, 1, 1, Color(110, 255, 255, 200) )     

end[/LUA]

[editline]4th January 2012[/editline]

I would like to keep this functionality:

Doing a single trace for all beams would stop them all short.

Besides that, performance doesn’t seem to be an issue, I’ve had multiples of the sent running with no performance hit.
I haven’t tested it on my dedi server yet, though.