I need to draw a line with Cam3D on the screen, no matter with IgnoreZ or without. Is it possible to draw it? It shoult be drawn from player's head to player's aiming pos.
I am just making a small swep that has to show where player looks, like an airstrike. Must be seen for people, too.
Did that with :ToScreen(). Not satisfied, but got no other options :(
Try this?
[lua] local pos = LocalPlayer():GetShootPos():ToScreen() -- position of the player's eyes
local x = ScrW() * 0.5
local y = ScrH() * 0.5
local tr = LocalPlayer():GetEyeTrace() -- performs a trace from the player's eyes to near inifinity
if( tr and tr.HitPos ) then
-- the trace hit somewhere, get that hit position and set our x and y to it
local localpos = tr.HitPos:ToScreen()
x = localpos.x
y = localpos.y
end
-- draw the line
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawLine( pos.x, pos.y, x, y )[/lua]
You'll need to do some work to get it to show for other players.
Sorry, you need to Log In to post a reply to this thread.