• a 3D2D HUD and questions
    0 replies, posted
Alrighty then gentlemen! So I'm a bit new here, had this account ages ago, never really used it. I've freshly read the rules and I believe I understand most of this. So as of lately, I got into learning Lua, I know hooks, returns, and basic functions and such. I've been working on learning most of the hooks that can benefit me, and I know their uses, and how to use them properly in every context; for the most part, that is. So I've been working on a 3D2D HUD, my only inspiration? Some guy made one, and I thought it looked cool, so I want to remake it. So far I've learned some things and I've made something work. Although, I used the wrong hook, so the hud on the screen was : ===== - Tiny - Able to have the arms and parts of viewmodels clip RIGHT through it - Not able to display text properly as, it was so pathetically small, that text couldn't actually be as small as the one element that I made of the HUD. ===== So, I am still learning of course, I am VERY bad at making complex or simple algorithms, I need experience. I have some code I've been working with, and haven't tested it neccesarily. I'd like to ask for some tips if things go south? Because I know this code is missing something, some of it is not mine, and was given to me by a friend. Albeit, I understand most of the code, if not all of it. Here's the code [code] hook.Add("PostDrawViewModel", 'test', function(ply, wep, vm) local pl = LocalPlayer(); if not IsValid(pl) then return end if pl:Alive() then local fov = pl:GetFOV(); local aspect = ScrW() / ScrH(); local factor = 20; local ang = vm:GetAngles(); ang:RotateAroundAxis(ang:Forward(), 90); ang:RotateAroundAxis(ang:Right(), 90); ang:RotateAroundAxis(ang:Right(), -15); --ang = Angle(0, ang.y, ang.r); local pos = Vector(1.11, aspect/2, 0.5) * factor; pos:Rotate(pl:EyeAngles()); pos:Add(vm:GetPos()); local scale = (1/ScrW()) * aspect * factor; cam.IgnoreZ(true); cam.Start3D2D() cam.End3D2D cam.IgnoreZ(false) end) [/code] If anyone could provide some tips or help for me, I'd absolutely love to learn. I apologize if this is the wrong place, and if there is something to surround code when you post it, still a bit new here! *EDIT* : Now of course I know there isn't anything IN there to actually put on the screen yet, I'm tinkering as we speak, although if anyone can correct me on any issues here, I'd absolutely love that. [editline]6th December 2015[/editline] So I made a little silly edit, just to test something. I recieved no errors but of course, nothing displayed on the screen, I believe I need to put something in cam.Start3D2D's parenthesis. That was of course part of my work in my other version of the HUD that "worked" [code] cam.Start3D2D() draw.RoundedBox( 4, ScrW/2, ScrH/2, 25, 24, (255,255,5,255) ) cam.End3D2D [/code] Of course I didn't expect this to work.
Sorry, you need to Log In to post a reply to this thread.