Hey, so I'm trying to make a DModelPanel of the play display on the HUD.
I'm currently using the following code to do so:
[code]
local function LoadHud()
local ayy, lmao = ScrW() / 1920, ScrW() / 1080
mdl = vgui.Create("DModelPanel")
mdl:SetPos(675 * ayy, 820 * lmao)
mdl:SetSize(500, 500)
mdl:SetFOV(20)
mdl:SetCamPos(Vector(200, 0, 50))
mdl:SetLookAt(Vector(0, 2, 45))
mdl:SetModel(LocalPlayer():GetModel())
mdl:SetDirectionalLight(BOX_RIGHT, Color(255, 255, 255, 255))
mdl:SetDirectionalLight(BOX_LEFT, Color(255, 255, 255, 255))
mdl:SetAmbientLight(Vector(-64, -64, -64))
mdl:SetColor(Color(255, 255, 255))
mdl:SetMouseInputEnabled(false)
function mdl:LayoutEntity(Entity) end
end
timer.Create("LoadHUD", 10, 1, function()
print("Loading HUD Element: HUD Model")
LoadHud()
end)
[/code]
For some odd reason, upon joining (and after running the timer) it displays correctly (sometimes for a few seconds)
After a few moments it seems to set itself to the side of the screen and return as a null entity for anything ran to it.
Example:
[t]https://i.gyazo.com/defe3dd7f1fd9522bac009e4b05bd7a6.png[/t]
Would anyone happen to know what's causing this? I'm almost clueless as to what's doing it.
Thanks.
Works fine for me :v:
Sorry, you need to Log In to post a reply to this thread.