• Drawing with cam.Start3D
    2 replies, posted
I want to draw a roundedbox in 3D space, this code works fine [code] hook.Add( "PostDrawEffects", "OnPaint", function() local pos = LocalPlayer():GetPos() local ang = LocalPlayer():GetAngles() cam.Start3D(pos + ang:Forward() * 32 + ang:Up() * 8, LocalPlayer():EyeAngles()) draw.RoundedBox(6, 50, 50, 100, 100, Color( 255, 255, 255 )) cam.End3D() end) [/code] However it brings back this mess: [IMG]http://i.imgur.com/9jz8ExM.png[/IMG] [IMG]http://i.imgur.com/5LjkDyr.png[/IMG] In what way should I do this so it draws normally? Thanks.
Use proper hook for the task. PostDrawTranslucentRenderables. [editline]31st August 2014[/editline] If you want to draw screens or w/e, you better use 3D2D camera, not 3d.
Progress! I tried this: [code] hook.Add( "PostDrawTranslucentRenderables", "OnPaint", function() local pos = Vector(x,y,z) local ang = LocalPlayer():GetAngles() cam.Start3D2D(pos + ang:Forward() * 32 + ang:Up() * 8, LocalPlayer():EyeAngles(), 1) draw.RoundedBox(6, 50, 50, 100, 100, Color( 255, 255, 255 )) cam.End3D2D() end) [/code] But now the boxs moves around with the players view angle. EDIT: Solved
Sorry, you need to Log In to post a reply to this thread.