• DModelPanel in a cam.Start3D2D?
    1 replies, posted
Hello again. I am trying to render a model ( like a DModelPanel in a derma menu ) in a 3D2D "environment". For example like a picture on a wall of someone but they move like in Harry Potter or something. This is what I have tried: local m = vgui.Create("DModelPanel") m:SetPos( 0, 0 ) m:SetSize( 100, 100 ) m:SetModel( LocalPlayer():GetModel() ) m:SetPaintedManually( true ) m.LayoutEntity = function() return false end m.Entity:SetEyeTarget( Vector( 100, 100, 100 ) ) m:SetCamPos( Vector( 45, 20, 64 ) ) local pos, ang = self:LocalToWorld( Vector( 0, 0, -z ) ), self:LocalToWorldAngles( Angle( 0, 90, 0 ) ) function ENT:Draw() cam.Start3D2D( pos, ang, 0.1 ) m:PaintManual() -- using this function cam.End3D2D() end Although this did work, but not entirely since the model was rendered on the top left corner of the screen and not in front of the entity. But when I looked away from the entity it disappeared. When I switched the DModelPanel to a normal DFrame it rendered on the entity as it should but it didn't do the same with the DModelPanel. I also tried doing this: function ENT:Drawn() local pos, ang = self:LocalToWorld( Vector( 0, 0, -z ) ), self:LocalToWorldAngles( Angle( 0, 90, 0 ) ) cam.Start3D2D( pos, ang, 0.1 ) cam.Start3D( Vector( 0, 0, 0 ), Angle( 0, 0, 0), 70 ) render.Model( { "models/props_c17/FurnitureWashingmachine001a.mdl", ppos, ppang } ) cam.End3D() cam.End3D2D() end This rendered a model but in 3D I think. But instead of in-front of the entity it was rendered on top of the clients head (looked like if you had an error viewmodel). Does anyone know how I could do this? Please help
ENT:Drawn() doesn't exists, you might mean Draw, also you don't have to start a 3D context if you're already running code inside your ENT:Draw() that's a 3D context aswell, I would recommend you to use ClientsideModel for draw your model, but you gotta keep a reference of it inside your entity and delete it by yourself, otherwise it wouldn't delete after your entity gets removed
Sorry, you need to Log In to post a reply to this thread.