Incorrect world door GetAngles()

I have the following problem:

The “prop_door_rotating” works because they get the right angle.
How can I get the angle of the world door?

That’s why I didn’t include support for brush doors in my script, because there’s no consistent way to get the proper angles and position, since the doors can be any shape or orientation.

A solution to this would be to use Propper and make all the brush doors into models.

That is no solution. You’d need to recompile the map.

There is a server which has 3d door text too, there the text is fine on all the doors including map doors (they run the same map). there has to be a solution?

For the time being, I could only suggest parenting an invisible model to all rotating doors when the server starts, and using them to get the angles. I haven’t tried this, but in theory it should work a dream.

How does having to recompile the map make it not a solution?

Would it not be possible to integrate the doors made with propper, into the map using lua? I.E. removing existing ones and placing the new ones?

Perhaps I’m wrong, I don’t really know if what I’m suggesting is even doable.

Recompiling is not an option, it is protected and will bring some other errors.

Hmm, maybe observing entity with GetSaveTable will give something

I observed the ent with picker, when the door opens, the angle will change.

Wait; can you provide more information about this? Entity type, if it is a func_brush, they can be targeted and information can be retrieved.

I’ll just post my awful script, and the door functions are: “func_door”, “func_door_rotating”

NOTE: I made this script my own, not copied or stole from someone!



/*---------------------------------------------------------------------------
Door 3D Data
---------------------------------------------------------------------------*/
hook.Add("PostDrawTranslucentRenderables","3ddoortext", function()
    for _,ent in pairs(ents.GetAll()) do
		if ent:GetClass() == "prop_door_rotating" or ent:GetClass() == "func_door" then
			if ent:GetPos():Distance(LocalPlayer():GetPos()) < 400 then
				
				local distfade = 255
				
				if ent:GetPos():Distance(LocalPlayer():GetPos()) > 300 then
					distfade = (255 * (400 - ent:GetPos():Distance( LocalPlayer():GetPos() ) ) ) / 100
				end
				
				local title = ent:doortitle() or "Buy this door (F2)"
		
				local DrawPos = ent:LocalToWorld(Vector(1.1,ent:OBBCenter().y,30))
	
				local DrawAngles = ent:GetAngles()
				DrawAngles:RotateAroundAxis(ent:GetAngles():Forward(), 90)
				DrawAngles:RotateAroundAxis(ent:GetAngles():Up(), 90)
			
				local DrawPos2 = ent:LocalToWorld(Vector(-1.1,ent:OBBCenter().y,30))
			
				local DrawAngles2 = ent:GetAngles()
				DrawAngles2:RotateAroundAxis(ent:GetAngles():Forward(), -90)
				DrawAngles2:RotateAroundAxis(ent:GetAngles():Up(), -90)
				DrawAngles2:RotateAroundAxis(ent:GetAngles():Right(), -180)
		
				cam.Start3D2D(DrawPos, DrawAngles, 0.1)
					draw.SimpleText(title, "DoorText", 0 ,0, Color(255,255,255,distfade), TEXT_ALIGN_CENTER)
				cam.End3D2D()
				cam.Start3D2D(DrawPos2, DrawAngles2, 0.1)
					draw.SimpleText(title, "DoorText", 0 ,0, Color(255,255,255,distfade), TEXT_ALIGN_CENTER)
				cam.End3D2D()
			end
		elseif ent:GetClass() == "func_door_rotating" then
			
				if ent:GetPos():Distance(LocalPlayer():GetPos()) < 400 then
				
				local distfade = 255
				
				if ent:GetPos():Distance(LocalPlayer():GetPos()) > 300 then
					distfade = (255 * (400 - ent:GetPos():Distance( LocalPlayer():GetPos() ) ) ) / 100
				end
				
				local title = ent:doortitle() or "Buy this door (F2)"
		
				local DrawPos = ent:LocalToWorld(Vector(ent:OBBCenter().x,ent:OBBCenter().y,30))
	
				local DrawAngles = ent:GetAngles()
				DrawAngles:RotateAroundAxis(ent:GetAngles():Forward(), 90)
				DrawAngles:RotateAroundAxis(ent:GetAngles():Up(), -180)
			
				local DrawPos2 = ent:LocalToWorld(Vector(ent:OBBCenter().x,ent:OBBCenter().y,30))
			
				local DrawAngles2 = ent:GetAngles()
				DrawAngles2:RotateAroundAxis(ent:GetAngles():Forward(), -90)
				DrawAngles2:RotateAroundAxis(ent:GetAngles():Up(), -180)
				DrawAngles2:RotateAroundAxis(ent:GetAngles():Right(), -180)
		
				cam.Start3D2D(DrawPos, DrawAngles, 0.1)
					draw.SimpleText(title, "DoorText", 0 ,0, Color(255,255,255,distfade), TEXT_ALIGN_CENTER)
				cam.End3D2D()
				cam.Start3D2D(DrawPos2, DrawAngles2, 0.1)
					draw.SimpleText(title, "DoorText", 0 ,0, Color(255,255,255,distfade), TEXT_ALIGN_CENTER)
				cam.End3D2D()
			end
		end
	end
end)


The second part where the “func_door” got his own If statement was to test.

You will have to recompile every single map that uses brush doors, it’s easier to just add exceptions for specific entities on specific maps then.

That’s again, too much work. You’ll have to do that for every map ever ( which isn’t an option )

Of course if you only make this for your own server, and only for one map, I guess this may be a solution ( If you got powerful enough PC to recompile a RP map AND you give enough shits to actually do this AND it will force your users to download the map once again ), but that’s a dumb solution.

Why would you have to recompile though? Wouldn’t it be possible to just remove the door after entities are initialized, and then replace them with a model version of it? Sure you’d have to manually make a list but if you really want to then the effort is worth it I suppose.

As I said, that would be a ( very stupid ) solution, but only** if you use ONE map.** And it is way easier to just add offset to the specific doors in the 3D2D script in this case, then doing a whole ton of workarounds for nothing.

well jeez sorry :tinfoil:

Add me on Steam; I’ll walk you through the process of how I do it with all doors. The main issue is the floating point issue with numbers, if you print out a certain number, sometimes it is altered from 40 to 39.999999999999999999998 or something like that. I made a few functions to properly detect positions of doors, door angles and to tell if they’re open or closed.