3D2D Text angle?

Hello everyone,

Im creating a 2d3d screen in my server. Never really made anything with it before so i thought it would be neat to try, However i have a problem.

The text is at a wierd angle? I assumed it would be straight? How do i rotate the text?

Heres my code:


hook.Add( "PostDrawOpaqueRenderables", "example", function()
	local pos = Vector(-1300, -400, 100)
	
	cam.Start3D2D(pos, Angle(115,0,0), 1)
		surface.SetDrawColor(255, 0, 0, 255)
		surface.DrawRect(0, 0, 200, 400)

		surface.SetFont("Trebuchet24")
		surface.SetTextColor(255, 255, 255, 255)
		surface.SetTextPos(20, 20)
		surface.DrawText("Test!")
	cam.End3D2D()
end)

Thanks in advance!

Just change angle in cam.Start3D2D arguments.

Obviously i would have tried that, No matter what i edit, it doesnt rotate the screen like that.

Angle( pitch, yaw, roll )

So, this should be all you need to do:


Angle( 115, 0, -90 )

Since we just need to rotate it 90 degrees counterclockwise


 hook.Add( "PostDrawOpaqueRenderables", "example", function()
	local pos = Vector(-1500, -400, 100)
	
	cam.Start3D2D(pos, Angle(0,90,90), 1)
		surface.SetDrawColor(255, 0, 0, 255)
		surface.DrawRect(0, 0, 200, 400)

		surface.SetFont("Trebuchet24")
		surface.SetTextColor(255, 255, 255, 255)
		surface.SetTextPos(20, 20)
		surface.DrawText("Test!")
	cam.End3D2D()
end)


As you can see, I’ve changed the following “cam.Start3D2D(pos, Angle(0,90,90), 1)”. This will place your red box with text facing upright towards the spawn, in gm_construct. Play with the numbers, reload the script using console.