• How to make a 3D HUD?
    6 replies, posted
Yeah basically how to make a 3D HUD. surface.Draw is 2D but i really want to try to make a 3D HUD.
cam.Start3D, cam.Start3D2D
[QUOTE=Robotboy655;42381118]cam.Start3D, cam.Start3D2D[/QUOTE] huh? Im bad at lua so a example of drawing a bar using cam.Start3D?
[QUOTE=Snorlaxs;42381147]huh? Im bad at lua so a example of drawing a bar using cam.Start3D?[/QUOTE] I agree, he should've explained the functions of those commands instead of just telling them. Still, you could've just looked at them [url= http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4771.html]here[/url] and [url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexedb0.html]here.[/url]
You can always pay for one.
You can use a neat trick to make all your hud elements drift with the player's movements. For example: [lua] local hl = {} --hl means hud lag. hook.Add("HUDPaint", "DrawOurHud", function() if not hl.na then hl.na = LocalPlayer():EyeAngles() end hl.la = hl.na hl.ca = LocalPlayer():EyeAngles() hl.x = (hl.ca.y - hl.la.y)*3 hl.y = (hl.la.p - hl.ca.p)*3 hl.nm = 1/5 --This is the speed at which the hud moves. 5 is a good number. hl.na = Angle((hl.ca.p*hl.nm+hl.la.p)/(hl.nm+1),(hl.ca.y*hl.nm+hl.la.y)/(hl.nm+1), 0) --Set the new angle surface.SetDrawColor(255,255,255,255) surface.DrawRect(ScrW()/2+hl.x, ScrH()/2+hl.y, 100, 100) --Add hl.x and hl.y to your position of ALL your hud elements. end) [/lua]
[QUOTE=bobbleheadbob;42413713]You can use a neat trick to make all your hud elements drift with the player's movements. For example: [lua] local hl = {} --hl means hud lag. hook.Add("HUDPaint", "DrawOurHud", function() if not hl.na then hl.na = LocalPlayer():EyeAngles() end hl.la = hl.na hl.ca = LocalPlayer():EyeAngles() hl.x = (hl.ca.y - hl.la.y)*3 hl.y = (hl.la.p - hl.ca.p)*3 hl.nm = 1/5 --This is the speed at which the hud moves. 5 is a good number. hl.na = Angle((hl.ca.p*hl.nm+hl.la.p)/(hl.nm+1),(hl.ca.y*hl.nm+hl.la.y)/(hl.nm+1), 0) --Set the new angle surface.SetDrawColor(255,255,255,255) surface.DrawRect(ScrW()/2+hl.x, ScrH()/2+hl.y, 100, 100) --Add hl.x and hl.y to your position of ALL your hud elements. end) [/lua][/QUOTE] <3
Sorry, you need to Log In to post a reply to this thread.