[IMG]http://i.imgur.com/AuBXwVU.jpg[/IMG]
[CODE]
local myMax = ply:GetShootPos()+(ply:GetAimVector()*500)
local myMin = myMax - Vector(50,500,50)
render.DrawLine(ply:GetShootPos(), myMax, Color (0,0,255), true)
render.DrawWireframeBox( Vector(0,0,0), Angle(0,0,0), myMin, myMax, Color(255,255,255), true )
[/CODE]
Basically I'm trying to draw a rectangle around the players aim vector.
I'm obviously doing this wrong, but the problem is I need the box to have a static length, width, and height.
My plan is to use the wireframe box for visualization until I can use the [CODE]ents.FindInBox(myMin, myMax)[/CODE] to loop through all entities so I can apply a velocity to them.
When I tried to change the Vector or Angle of the wireframe box it rotated around the wrong axis.
[thumb]http://puu.sh/5LETv.jpg[/thumb]
[lua]
if SERVER then
AddCSLuaFile()
else
local plyForwardDist = 500
hook.Add("PostDrawOpaqueRenderables", "DrawBoxHelp", function()
local ply = LocalPlayer()
if !IsValid(ply) then return end
local plyPos = ply:GetPos()
local plyAngles = ply:GetAngles()
local plyOBBMins = ply:OBBMins()
local plyOBBMaxs = ply:OBBMaxs()
render.DrawWireframeBox(plyPos, Angle(0,plyAngles.y,0), plyOBBMins, Vector(plyForwardDist,plyOBBMaxs.y,plyOBBMaxs.z), Color(255,255,255), false)
end)
end
[/lua]
Sorry, you need to Log In to post a reply to this thread.