3D2D Camera - surface.DrawBox - Glitch

Hi,

i bought a cool addon called The Real Printers from scriptfodder, unfortunately this addon is eating too much fps and it is not object oriented. So yeah, i’m about to develope my own printers on his models.

Sadly, i have the following problem right now, as you can see i am drawing a simple black Box BUT as soon as there’s another entity behind the box (Door, Button or other Drawings) they just pass through my drawing.

Here’s a image:

Code:


function ENT:Draw()
	self:DrawModel()
	
	local Pos = self:GetPos()
	if Pos:Distance(LocalPlayer():GetPos()) > 300 then return end
	local Ang = self:GetAngles()
	
	Ang:RotateAroundAxis(Ang:Up(), 90)
	Ang:RotateAroundAxis(Ang:Forward(), 90)
	
	cam.Start3D2D(Pos, Ang, 0.1)
		if self:GetPower() then
			self:DrawMonitor()
		end
	cam.End3D2D()
end

function ENT:DrawMonitor()
	surface.SetDrawColor(Color(0, 0, 0, 255))
	surface.DrawRect(100, -57, 400, 400)
end


Now however, if i use the orginal printers there’s no props going through that drawing but i can’t find any useful informations on how it’s working.

I hope i can get some help here

  • Momo

Use DrawTranslucent entity hook instead of Draw.


function ENT:DrawTranslucent()
	print("DrawTranslucent")
end

Doesn’t work, there’s no output in my console window.

Dunno what this function is doing, Wiki doesn’t give me more informations either.

Edit: Okay got DrawTranslucent working with:

ENT.RenderGroup = RENDERGROUP_BOTH

Problem solved, thanks wyozi

For anyone else: You can fix this problem by settings ENT.RenderGroup to RENDERGROUP_BOTH in your shared.lua