Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VCube = {
- top = {
- fl = Vector(0,0,0),
- fr = Vector(0,0,0),
- bl = Vector(0,0,0),
- br = Vector(0,0,0),
- center = Vector(0,0,0)
- },
- bottom = {
- fl = Vector(0,0,0),
- fr = Vector(0,0,0),
- bl = Vector(0,0,0),
- br = Vector(0,0,0),
- center = Vector(0,0,0)
- }
- };
- if ( CLIENT ) then
- function VCube:Render()
- local Laser = Material( "cable/redlaser" )
- render.SetMaterial( Laser )
- -- Top
- render.DrawBeam( self.top.fl, self.top.fr, 5, 1, 1, Color( 0, 0, 255, 255 ) );
- render.DrawBeam( self.top.bl, self.top.fl, 5, 1, 1, Color( 0, 0, 255, 255 ) );
- render.DrawBeam( self.top.bl, self.top.br, 5, 1, 1, Color( 0, 0, 255, 255 ) );
- render.DrawBeam( self.top.br, self.top.fr, 5, 1, 1, Color( 0, 0, 255, 255 ) );
- -- Top to bottom corners
- render.DrawBeam( self.top.fl, self.bottom.fl, 5, 1, 1, Color( 0, 0, 255, 255 ) );
- render.DrawBeam( self.top.fr, self.bottom.fr, 5, 1, 1, Color( 0, 0, 255, 255 ) );
- render.DrawBeam( self.top.bl, self.bottom.bl, 5, 1, 1, Color( 0, 0, 255, 255 ) );
- render.DrawBeam( self.top.br, self.bottom.br, 5, 1, 1, Color( 0, 0, 255, 255 ) );
- -- Bottom
- render.DrawBeam( self.bottom.fl, self.bottom.fr, 5, 1, 1, Color( 0, 0, 255, 255 ) );
- render.DrawBeam( self.bottom.bl, self.bottom.fl, 5, 1, 1, Color( 0, 0, 255, 255 ) );
- render.DrawBeam( self.bottom.bl, self.bottom.br, 5, 1, 1, Color( 0, 0, 255, 255 ) );
- render.DrawBeam( self.bottom.br, self.bottom.fr, 5, 1, 1, Color( 0, 0, 255, 255 ) );
- end
- end
- function VCube:PointCube( tbl, origin, width, height)
- tbl = tbl or { }
- setmetatable( tbl, self );
- self.__index = self
- local bottom_center = Vector( origin.x, origin.y, origin.z - ( height / 2 ) );
- local bottom_fr = Vector( bottom_center.x + (width / 2), bottom_center.x + (width/2), bottom_center.z);
- local bottom_fl = Vector( bottom_center.x - (width / 2), bottom_center.y + (width/2), bottom_center.z);
- local bottom_br = Vector( bottom_center.x + (width / 2), bottom_center.y - (width/2), bottom_center.z);
- local bottom_bl = Vector( bottom_center.x - (width / 2), bottom_center.y - (width/2), bottom_center.z);
- local top_center = Vector( origin.x, origin.y, origin.z + ( height / 2 ) );
- local top_fr = Vector( bottom_center.x + (width / 2), bottom_center.y + (width/2), bottom_center.z + height);
- local top_fl = Vector( bottom_center.x - (width / 2), bottom_center.y + (width/2), bottom_center.z + height);
- local top_br = Vector( bottom_center.x + (width / 2), bottom_center.y - (width/2), bottom_center.z + height);
- local top_bl = Vector( bottom_center.x - (width / 2), bottom_center.y - (width/2), bottom_center.z + height);
- tbl.top.fl = top_fl;
- tbl.top.fr = top_fr;
- tbl.top.bl = top_bl;
- tbl.top.br = top_br;
- tbl.top.center = top_center;
- tbl.bottom.fl = bottom_fl;
- tbl.bottom.fr = bottom_fr;
- tbl.bottom.bl = bottom_bl;
- tbl.bottom.br = bottom_br;
- tbl.bottom.center = bottom_center;
- tbl.center = origin;
- return tbl;
- end
Add Comment
Please, Sign In to add comment