I’m using a cam.Start3D and cam.Start3D2D. I’ve got it to work how I want, although I’m having issues with the drawn items bouncing whenever a player encounters a step or a fall or damage( tested explosive). I’ve tried correcting it with GetViewPunchAngles, but that doesnt seem to affect anything, nor does it return a useful value when a player step happens. The Start3D is constructed without any arguments, while the Start3D2D is constructed from EyePos and EyeAngles. So overall I’m not really sure if it’s EyePos/Angles or ViewPunches, or both that are causing the issue.
I’d appreciate any help or suggestions, Thanks!
And here’s the code I’ve written if anyone wants to test it out first hand (go run up some stairs):
local screenx = ScrW() local screeny = ScrH() local screenmin if(screenx>=screeny) then screenmin=screeny else screenmin=screenx end hook.Add("HUDPaint","MyHUDTest",function() local player = LocalPlayer() local eyepos = player:EyePos() local eyeangles = player:EyeAngles() cam.Start3D() cam.Start3D2D( eyepos + eyeangles:Forward()*(math.sqrt(screenx*screeny)/2) + eyeangles:Right()*-(screenx/2) + eyeangles:Up()*(screeny/2), eyeangles + Angle(90,0,0), 1 ) surface.SetDrawColor( Color( 255, 165, 0, 255 ) ) surface.DrawRect( 0, 0, 10, 10 ) surface.SetDrawColor(Color(255,0,0,255)) surface.DrawRect(10,10,10,10) cam.End3D2D() cam.End3D() surface.SetDrawColor( Color( 255, 165, 0, 255 ) ) surface.DrawRect( 20, 20, 10, 10 ) surface.SetDrawColor(Color(255,0,0,255)) surface.DrawRect(30,30,10,10) end)