• Player Model and hats
    4 replies, posted
I created the DModelPanel for the player but I was wondering how to make it so it will show the HAT that is wearing. I am using PointShop. And I am using [url=http://facepunch.com/member.php?u=484028]ben434[/url] function. [lua] hook.Add("InitPostEntity", "DrawPlayerModel", function() iconmodel = vgui.Create("DModelPanel") iconmodel:SetModel( LocalPlayer():GetModel()) function iconmodel:LayoutEntity( Entity ) return end iconmodel:SetPos(0, ScrH() - 250) iconmodel:SetAnimated(true) iconmodel:SetSize(250,250) iconmodel:SetCamPos( Vector( 25, 10, 65)) iconmodel:SetLookAt( Vector( 0, 10, 66.5 ) ) timer.Create("RefreshAvatar", 1, 0, function() if LocalPlayer():GetModel() ~= iconmodel.Entity:GetModel() then iconmodel:Remove() iconmodel = vgui.Create("DModelPanel") iconmodel:SetPos(0, ScrH() - 250) iconmodel:SetModel( LocalPlayer():GetModel()) function iconmodel:LayoutEntity( Entity ) return end iconmodel:SetAnimated(false) iconmodel:SetSize(250,250) iconmodel:SetCamPos( Vector( 25, 10, 65)) iconmodel:SetLookAt( Vector( 0, 10, 66.5 ) ) end end) [/lua]
[QUOTE]And I am using ben434 model panel[/QUOTE] I didn't know I had my own model panel :v: But anyways, why not look in pointshop's code to see how _Undefined did it? [editline]3:23[/editline] [url]https://github.com/adamdburton/pointshop/blob/master/lua/vgui/DPointShopPreview.lua[/url] - It's right there, he made his own custom VGUI for it.
[QUOTE=ben434;40980851]I didn't know I had my own model panel :v: But anyways, why not look in pointshop's code to see how _Undefined did it? [editline]3:23[/editline] [url]https://github.com/adamdburton/pointshop/blob/master/lua/vgui/DPointShopPreview.lua[/url] - It's right there, he made his own custom VGUI for it.[/QUOTE] You know what I mean. And I looked but I can't say I know where to look. I looked in DPointShopPreview.lua i don't think this is the correct file but I don't really know where else to look.
Well, first of all. He's not using DModelPanel, and I don't think you even can. Here is the function he uses to display them. [lua] local w, h = self:GetSize() cam.Start3D( self.vCamPos, ang, self.fFOV, x, y, w, h, 5, 4096 ) cam.IgnoreZ( true ) render.SuppressEngineLighting( true ) render.SetLightingOrigin( self.Entity:GetPos() ) render.ResetModelLighting( self.colAmbientLight.r/255, self.colAmbientLight.g/255, self.colAmbientLight.b/255 ) render.SetColorModulation( self.colColor.r/255, self.colColor.g/255, self.colColor.b/255 ) render.SetBlend( self.colColor.a/255 ) for i=0, 6 do local col = self.DirectionalLight[ i ] if ( col ) then render.SetModelLighting( i, col.r/255, col.g/255, col.b/255 ) end end self.Entity:DrawModel() self:DrawOtherModels() -- Here he draws the attachments render.SuppressEngineLighting( false ) cam.IgnoreZ( false ) cam.End3D() [/lua]
Thank you.
Sorry, you need to Log In to post a reply to this thread.