door text

Hello all,

what is the to draw text on entities externally? I want 3d text on all the doors. Which hook is needed for that?

PostDrawTranslucentRenderables and cam.Start3D2D.

That works great, Thanks man! You’re awesome!


I wanted to get the center of the door, that worked. But the angles are still on the normal location, as result: When I open the door the text doesn’t get properkly placed and dissapears inside the door. How can I fix this?

function GM:PostDrawTranslucentRenderables()
    for _,ent in pairs(ents.GetAll()) do
		if ent:GetClass() == "prop_door_rotating" then
			local DrawPos = ent:LocalToWorld(ent:OBBCenter()) + Vector(1.1,0,0)
			local DrawAngles = ent:GetAngles()
			DrawAngles:RotateAroundAxis(ent:GetAngles():Forward(), 90)
			DrawAngles:RotateAroundAxis(ent:GetAngles():Up(), 90)
			cam.Start3D2D(DrawPos, DrawAngles, 0.1)
				draw.SimpleText("DoorText", "default", 0 ,0, Color(255,255,255,255), TEXT_ALIGN_CENTER)

Use a hook, not a gamemode function.

You need to place it yourself, not just on the vector 0,0,0 of the door.

You mean I cannot use ent:OBBCenter() to center the text to make sure it works on every doorin the map?


Wait, using OBBCenter I can get the center. If I just add that value to the text vector it will be good.

Thanks all!