• Model on DermaPanel?
    13 replies, posted
So I am trying to add a model to the dermapanel, but it is not showing up once I add it to the DermaList (DPanelList). Once I remove it from the list it shows up, is the dermapanel cutting it off? Here is my code: [CODE] local PistolModel = vgui.Create( "DModelPanel" ) PistolModel:SetPos( 25, 15 ) PistolModel:SetSize( 500, 500 ) PistolModel:SetModel( "models/Items/357ammo.mdl" ) function PistolModel:LayoutEntity( Entity ) return end function PistolModel.Entity:GetPlayerColor() return Vector ( 1, 0, 0 ) end DermaList:Add(PistolModel) [/CODE]
You are not setting the camera position/angles.
[QUOTE=Robotboy655;50027899]You are not setting the camera position/angles.[/QUOTE] Okay I added the camerapos, but it is still not showing. [CODE] local PistolModel = vgui.Create( "DModelPanel" ) PistolModel:SetPos( 25, 15 ) PistolModel:SetSize( 500, 500 ) PistolModel:SetModel( "models/Items/357ammo.mdl" ) function PistolModel:LayoutEntity( Entity ) return end function PistolModel.Entity:GetPlayerColor() return Vector ( 1, 0, 0 ) end PistolModel:SetCamPos( Vector( 50, 50, 50 ) ) DermaList:Add(PistolModel) [/CODE]
[QUOTE=tripps41;50028110]Okay I added the camerapos, but it is still not showing. [CODE] local PistolModel = vgui.Create( "DModelPanel" ) PistolModel:SetPos( 25, 15 ) PistolModel:SetSize( 500, 500 ) PistolModel:SetModel( "models/Items/357ammo.mdl" ) function PistolModel:LayoutEntity( Entity ) return end function PistolModel.Entity:GetPlayerColor() return Vector ( 1, 0, 0 ) end PistolModel:SetCamPos( Vector( 50, 50, 50 ) ) DermaList:Add(PistolModel) [/CODE][/QUOTE] I still have this issue with it not showing on the derma panel, but another question popped into my head, how would I add a roundedbox behind the model and text?
[CODE] local Frame = vgui.Create( "DFrame" ) Frame:SetSize( 800, 500 ) Frame:SetPos( ScrW() / 2 - 250, ScrH() / 2 - 250 ) Frame:SetTitle( "Testing Derma" ) Frame:MakePopup() local icon = vgui.Create( "DModelPanel", Frame ) icon:SetSize( 500, 500 ) icon:SetPos( ScrW() / 2 - 195, ScrH() / 2 - 350 ) icon:SetModel( LocalPlayer():GetModel() ) [/CODE] Not sure if this would be the issue but when you make your DFrame, you might have to add the name to the DModelPanel as I did with the [CODE]( "DModelPanel", Frame ) [/CODE]
[QUOTE=274112;50035983][CODE] local Frame = vgui.Create( "DFrame" ) Frame:SetSize( 800, 500 ) Frame:SetPos( ScrW() / 2 - 250, ScrH() / 2 - 250 ) Frame:SetTitle( "Testing Derma" ) Frame:MakePopup() local icon = vgui.Create( "DModelPanel", Frame ) icon:SetSize( 500, 500 ) icon:SetPos( ScrW() / 2 - 195, ScrH() / 2 - 350 ) icon:SetModel( LocalPlayer():GetModel() ) [/CODE] Not sure if this would be the issue but when you make your DFrame, you might have to add the name to the DModelPanel as I did with the [CODE]( "DModelPanel", Frame ) [/CODE][/QUOTE] Well that did help with it showing off the screen, which I should of added to the frame in the first place, but it is not showing when I add it to the derma list ( DPanelList ).
So when I was adding text to the entity via (Ent:Draw) it is not facing me, what would I do to have it face me? I still have the issue with the model not showing, and how would I add a box behind the text and model? [CODE] function ENT:Draw() self:DrawModel() local Pos = self:GetPos() local Ang = self:GetAngles() bail = "Police Armory" surface.SetFont("HUDNumber5") local TextWidth = surface.GetTextSize(press) local TextWidth3 = surface.GetTextSize(bail) Ang:RotateAroundAxis(Ang:Forward(), 90) cam.Start3D2D(Pos + Ang:Forward() * 3.5, Ang, 0.11) draw.WordBox(2, -TextWidth3*0.5, -30, bail, "HUDNumber5", Color(0, 0, 0, 100), Color(255,255,255,255)) cam.End3D2D() end [/CODE] [IMG]https://i.gyazo.com/03fa03f64a5d45286a3aaa6939e9eda0.jpg[/IMG]
..You need to angle it correctly?
[QUOTE=Invule;50039872]..You need to angle it correctly?[/QUOTE] I know that, but I was asking what angle should I set it to..
[QUOTE=tripps41;50040092]I know that, but I was asking what angle should I set it to..[/QUOTE] try 90 then 180 then -90 then -180 etc etc etc
[QUOTE=Soren;50040108]try 90 then 180 then -90 then -180 etc etc etc[/QUOTE] I had to do both 'Ang:RotateAroundAxis(Ang:Forward(), 90)' and 'Ang:RotateAroundAxis(Ang:Up(), 90)', but now how would I move it forward?
Bump. Still having the issue with the ang and the model not showing.
you have to set the vector of the 3d text
[video=youtube;qi4cmukSUP0]https://www.youtube.com/watch?v=qi4cmukSUP0&index=17&list=PLyQg3m0a5UivaAXEfVDngKYp9jyNSTIo_[/video] might will help you.
Sorry, you need to Log In to post a reply to this thread.