• See props behind a 3D2D panel
    16 replies, posted
Hello everyone please read everything before reply. I just finish my baking system but i saw this : [IMG]http://image.prntscr.com/image/eb195c22edd04324aa84cd2a40459d9f.png[/IMG] Yes we can see props behind the panel. I've already try to use cam.IgnoreZ(true) and use surface.??? but it's still don't working properly. Here is the part of my code : [CODE] function ENT:Draw() self:DrawModel() if isBaking == 1 then local ang = self:GetAngles() local pos = self:GetPos() + Vector(10,26,58) ang:RotateAroundAxis(self:GetRight() , 90) ang:RotateAroundAxis(self:GetUp(), 10) ang:RotateAroundAxis(self:GetForward(), 90) cam.Start3D2D(pos , ang ,1) surface.SetDrawColor(41, 41, 41) surface.DrawRect(0, 0, 52, 40) surface.SetDrawColor(70, 70, 70) surface.DrawRect(1, 1, 50, 38) cam.End3D2D() local angbk = self:GetAngles() local posbk = self:LocalToWorld(Vector(14,-17,35)) angbk:RotateAroundAxis(self:GetRight() , -90) angbk:RotateAroundAxis(self:GetUp(), 10) angbk:RotateAroundAxis(self:GetForward(), 90) cam.Start3D2D(posbk , angbk , 0.2) local finishtime = self:GetNWInt("FinishBakeTime") local finishbar = (finishtime-CurTime())*40 draw.SimpleText("Cooking","BkFont", -5, -15,Color(0,255,0)) draw.SimpleText("Please Wait...","BkFont2", 36, 50,Color(0,255,0)) draw.RoundedBox(0,-15,-100,200,40,Color(20,20,20)) draw.RoundedBox(0,-15,-100,finishbar,40,Color(150,255,150)) cam.End3D2D() end end [/CODE] Thanks for answer, Have a nice day, Yazrihm.
suppr you addon
Set your render group to BOTH
[QUOTE=Robotboy655;51216167]Set your render group to BOTH[/QUOTE] Here is a screen : [IMG]http://image.prntscr.com/image/d3785af89db34d9ab982d236d3e7f589.png[/IMG] My code : [CODE] function ENT:Draw(RENDERGROUP_BOTH) self:DrawModel() local isBaking = self:GetNWInt("isBaking") if isBaking == 1 then local ang = self:GetAngles() local pos = self:LocalToWorld(Vector(10,26,58)) ang:RotateAroundAxis(self:GetRight() , 90) ang:RotateAroundAxis(self:GetUp(), 10) ang:RotateAroundAxis(self:GetForward(), 90) cam.Start3D2D(pos , ang ,1) surface.SetDrawColor(41, 41, 41) surface.DrawRect(0, 0, 52, 40) surface.SetDrawColor(70, 70, 70) surface.DrawRect(1, 1, 50, 38) cam.End3D2D() local angbk = self:GetAngles() local posbk = self:LocalToWorld(Vector(14,-17,35)) angbk:RotateAroundAxis(self:GetRight() , -90) angbk:RotateAroundAxis(self:GetUp(), 10) angbk:RotateAroundAxis(self:GetForward(), 90) cam.Start3D2D(posbk , angbk , 0.2) local finishtime = self:GetNWInt("FinishBakeTime") local finishbar = (finishtime-CurTime())*40 draw.SimpleText("Cooking","BkFont", -5, -15,Color(0,255,0)) draw.SimpleText("Please Wait...","BkFont2", 36, 50,Color(0,255,0)) draw.RoundedBox(0,-15,-100,200,40,Color(20,20,20)) draw.RoundedBox(0,-15,-100,finishbar,40,Color(150,255,150)) cam.End3D2D() end //////////////// INTERACTION MENU ///////////// local angim = self:GetAngles() local posim = self:LocalToWorld(Vector(21,-12,13)) local ply = LocalPlayer() local eyetrace = ply:GetEyeTrace() angim:RotateAroundAxis(self:GetRight() , -89) angim:RotateAroundAxis(self:GetUp(), 60) angim:RotateAroundAxis(self:GetForward(), 89) if eyetrace.Entity:GetClass() == "cooker" then if self:GetNWInt("isBaking") == 0 then cam.Start3D2D(posim , angim , 0.2) cam.IgnoreZ(false) draw.SimpleText("Press 'E'","BkImFont1",0,0,Color(20,255,20)) draw.SimpleText("to choose the recipe","BkImFont2",-10,60,Color(20,255,20)) cam.End3D2D() end end end [/CODE]
ENT.RenderGroup = RENDERGROUP_BOTH
Still won't work. Code ( shared.lua ) : [CODE] ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.RenderGroup = 9 [/CODE]
Why is the render group 9
[QUOTE=Minelayer;51216367]Why is the render group 9[/QUOTE] [url]https://wiki.garrysmod.com/page/Enums/RENDERGROUP[/url] [t]https://i.gyazo.com/5a5c822052dd9e1ba9b3b3bf647146b5.png[/t] RENDERGROUP_BOTH == 9
With [CODE]RENDERGROUP_BOTH[/CODE] or 9 it's not working.
[url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/base/entities/entities/base_anim.lua#L45-L52[/url]
Use ENT:DrawTranslucent() instead of ENT:Draw()
:/ [IMG]http://image.prntscr.com/image/fe434b209cc44d2eb55d680bedd86516.png[/IMG] Code : [CODE] function ENT:Draw() self:DrawModel() local isBaking = self:GetNWInt("isBaking") if isBaking == 1 then local ang = self:GetAngles() local pos = self:LocalToWorld(Vector(10,26,58)) ang:RotateAroundAxis(self:GetRight() , 90) ang:RotateAroundAxis(self:GetUp(), 10) ang:RotateAroundAxis(self:GetForward(), 90) cam.Start3D2D(pos , ang ,1) surface.SetDrawColor(41, 41, 41) surface.DrawRect(0, 0, 52, 40) surface.SetDrawColor(70, 70, 70) surface.DrawRect(1, 1, 50, 38) cam.End3D2D() local angbk = self:GetAngles() local posbk = self:LocalToWorld(Vector(14,-17,35)) angbk:RotateAroundAxis(self:GetRight() , -90) angbk:RotateAroundAxis(self:GetUp(), 10) angbk:RotateAroundAxis(self:GetForward(), 90) cam.Start3D2D(posbk , angbk , 0.2) local finishtime = self:GetNWInt("FinishBakeTime") local finishbar = (finishtime-CurTime())*40 draw.SimpleText("Cooking","BkFont", -5, -15,Color(0,255,0)) draw.SimpleText("Please Wait...","BkFont2", 36, 50,Color(0,255,0)) draw.RoundedBox(0,-15,-100,200,40,Color(20,20,20)) draw.RoundedBox(0,-15,-100,finishbar,40,Color(150,255,150)) cam.End3D2D() end //////////////// INTERACTION MENU ///////////// local angim = self:GetAngles() local posim = self:LocalToWorld(Vector(21,-12,13)) local ply = LocalPlayer() local eyetrace = ply:GetEyeTrace() angim:RotateAroundAxis(self:GetRight() , -89) angim:RotateAroundAxis(self:GetUp(), 60) angim:RotateAroundAxis(self:GetForward(), 89) if eyetrace.Entity:GetClass() == "cooker" then if self:GetNWInt("isBaking") == 0 then cam.Start3D2D(posim , angim , 0.2) cam.IgnoreZ(false) draw.SimpleText("Press 'E'","BkImFont1",0,0,Color(20,255,20)) draw.SimpleText("to choose the recipe","BkImFont2",-10,60,Color(20,255,20)) cam.End3D2D() end end end function ENT:DrawTranslucent() self:Draw() end [/CODE]
[QUOTE=Yazrihm;51216911]:/ [IMG]http://image.prntscr.com/image/fe434b209cc44d2eb55d680bedd86516.png[/IMG] Code : [CODE] function ENT:Draw() self:DrawModel() local isBaking = self:GetNWInt("isBaking") if isBaking == 1 then local ang = self:GetAngles() local pos = self:LocalToWorld(Vector(10,26,58)) ang:RotateAroundAxis(self:GetRight() , 90) ang:RotateAroundAxis(self:GetUp(), 10) ang:RotateAroundAxis(self:GetForward(), 90) cam.Start3D2D(pos , ang ,1) surface.SetDrawColor(41, 41, 41) surface.DrawRect(0, 0, 52, 40) surface.SetDrawColor(70, 70, 70) surface.DrawRect(1, 1, 50, 38) cam.End3D2D() local angbk = self:GetAngles() local posbk = self:LocalToWorld(Vector(14,-17,35)) angbk:RotateAroundAxis(self:GetRight() , -90) angbk:RotateAroundAxis(self:GetUp(), 10) angbk:RotateAroundAxis(self:GetForward(), 90) cam.Start3D2D(posbk , angbk , 0.2) local finishtime = self:GetNWInt("FinishBakeTime") local finishbar = (finishtime-CurTime())*40 draw.SimpleText("Cooking","BkFont", -5, -15,Color(0,255,0)) draw.SimpleText("Please Wait...","BkFont2", 36, 50,Color(0,255,0)) draw.RoundedBox(0,-15,-100,200,40,Color(20,20,20)) draw.RoundedBox(0,-15,-100,finishbar,40,Color(150,255,150)) cam.End3D2D() end //////////////// INTERACTION MENU ///////////// local angim = self:GetAngles() local posim = self:LocalToWorld(Vector(21,-12,13)) local ply = LocalPlayer() local eyetrace = ply:GetEyeTrace() angim:RotateAroundAxis(self:GetRight() , -89) angim:RotateAroundAxis(self:GetUp(), 60) angim:RotateAroundAxis(self:GetForward(), 89) if eyetrace.Entity:GetClass() == "cooker" then if self:GetNWInt("isBaking") == 0 then cam.Start3D2D(posim , angim , 0.2) cam.IgnoreZ(false) draw.SimpleText("Press 'E'","BkImFont1",0,0,Color(20,255,20)) draw.SimpleText("to choose the recipe","BkImFont2",-10,60,Color(20,255,20)) cam.End3D2D() end end end function ENT:DrawTranslucent() self:Draw() end [/CODE][/QUOTE] don't call draw from DrawTranslucent. [code] ENT:Draw() self:DrawModel() end ENT:DrawTranslucent() -- do your 3d2d stuff here end [/code]
It's drawing nothing : [IMG]http://image.prntscr.com/image/477577f7bdba45d493f3bd027d23d954.png[/IMG] [CODE] function ENT:Draw() self:DrawModel() end function ENT:DrawTranslucent() local isBaking = self:GetNWInt("isBaking") if isBaking == 1 then local ang = self:GetAngles() local pos = self:LocalToWorld(Vector(10,26,58)) ang:RotateAroundAxis(self:GetRight() , 90) ang:RotateAroundAxis(self:GetUp(), 10) ang:RotateAroundAxis(self:GetForward(), 90) cam.Start3D2D(pos , ang ,1) surface.SetDrawColor(41, 41, 41) surface.DrawRect(0, 0, 52, 40) surface.SetDrawColor(70, 70, 70) surface.DrawRect(1, 1, 50, 38) cam.End3D2D() local angbk = self:GetAngles() local posbk = self:LocalToWorld(Vector(14,-17,35)) angbk:RotateAroundAxis(self:GetRight() , -90) angbk:RotateAroundAxis(self:GetUp(), 10) angbk:RotateAroundAxis(self:GetForward(), 90) cam.Start3D2D(posbk , angbk , 0.2) local finishtime = self:GetNWInt("FinishBakeTime") local finishbar = (finishtime-CurTime())*40 draw.SimpleText("Cooking","BkFont", -5, -15,Color(0,255,0)) draw.SimpleText("Please Wait...","BkFont2", 36, 50,Color(0,255,0)) draw.RoundedBox(0,-15,-100,200,40,Color(20,20,20)) draw.RoundedBox(0,-15,-100,finishbar,40,Color(150,255,150)) cam.End3D2D() end //////////////// INTERACTION MENU ///////////// local angim = self:GetAngles() local posim = self:LocalToWorld(Vector(21,-12,13)) local ply = LocalPlayer() local eyetrace = ply:GetEyeTrace() angim:RotateAroundAxis(self:GetRight() , -89) angim:RotateAroundAxis(self:GetUp(), 60) angim:RotateAroundAxis(self:GetForward(), 89) if eyetrace.Entity:GetClass() == "cooker" then if self:GetNWInt("isBaking") == 0 then cam.Start3D2D(posim , angim , 0.2) cam.IgnoreZ(false) draw.SimpleText("Press 'E'","BkImFont1",0,0,Color(20,255,20)) draw.SimpleText("to choose the recipe","BkImFont2",-10,60,Color(20,255,20)) cam.End3D2D() end end end [/CODE]
then the rendergroup of your custom entity is not set to RENDERGROUP_BOTH
Your render group is still set to opaque. That's the only way that barrel will draw over your 3d2d.
[QUOTE=Z0mb1n3;51217137]then the rendergroup of your custom entity is not set to RENDERGROUP_BOTH[/QUOTE] Thanks thanks and thanks [url]http://prntscr.com/cvi860[/url]
Sorry, you need to Log In to post a reply to this thread.