Code |
// setup our variables
local start_pos = Vector();
local end_pos = VectorRand() * 1024;
local dir = ( end_pos - start_pos );
local increment = dir:Length() / 12;
dir:Normalize();
// set material
render.SetMaterial( laser );
// start the beam with 14 points
render.StartBeam( 14 );
// add start
render.AddBeam(
start_pos, // Start position
32, // Width
CurTime(), // Texture coordinate
Color( 64, 255, 64, 255 ) // Color
);
//
local i;
for i = 1, 12 do
// get point
local point = ( start_pos + dir * ( i * increment ) ) + VectorRand() * math.random( 1, 16 );
// texture coords
local tcoord = CurTime() + ( 1 / 12 ) * i;
// add point
render.AddBeam(
point,
32,
tcoord,
Color( 64, 255, 64, 255 )
);
end
// add the last point
render.AddBeam(
end_pos,
32,
CurTime() + 1,
Color( 64, 255, 64, 255 )
);
// finish up the beam
render.EndBeam();
|