• 3D2D In HUDPaint not working
    6 replies, posted
So I have this: [LUA] hook.Add("HUDPaint", "drawsomthings", function() cam.Start3D2D( LocalPlayer():GetEyeTrace().HitPos + Vector(0,0,40), Angle( 0,0,0 ), 1) surface.SetDrawColor(255,255,255) surface.DrawRect(0,0,50,50) cam.End3D2D() end) [/LUA] And it's not drawing anything. I then put the cam section inside PostPlayerDraw, and it works fine. What am I doing wrong? Can it not be called inside HUDPaint?
New wiki doesn't say it but: [code]Additional Notes Seems to only work when called in ENT.Draw, ENT.DrawTranslucent, EFFECT.Render, Gamemode.PostDrawOpaqueRenderables , Gamemode.HUDPaint or SWEP.ViewModelDrawn. You may also use this inside of RenderScreenspaceEffects, if it's wrapped in cam.Start3D and cam.End3D. This may be used to draw a computer screen on a prop. It should also be noted that the position and angle do not seem to update when this is hooked via HUDPaint. The HUDPaint will draw in relevance to the HUD orthographic projection, to update, hook it to a render function such as ENT:Draw() and make use of surface drawing to render properly and to avoid overlaps of certain places. Forgetting the scale argument can cause a hilarious rendering fail This doesn't seem to happen anymore, but you can get the same effect (IgnoreZ) by forgetting cam.End3D2D() These functions may be helpful for converting between Draw3D2D screen coordinates and world coordinates:[/code] One of these might answer your question
Yeah, I saw that on the wiki too, but it didn't seem to relate, as nothing was drawing within HUDPaint. Currently I'm using PostDrawOpaqueRenderables and its working
You must do cam.Start3D first so you can do 3D2D in a 2D painting hook.
[QUOTE=Robotboy655;41370941]You must do cam.Start3D first so you can do 3D2D in a 2D painting hook.[/QUOTE] Would it just be better to do it in PostDrawOpaqueRenderables?
[QUOTE=PaellaPablo;41371035]Would it just be better to do it in PostDrawOpaqueRenderables?[/QUOTE] Yes.
Cheers, marking as solved.
Sorry, you need to Log In to post a reply to this thread.