Draw 2d text in the air???

How do people do it?
Or just how to draw 2d polys in the air? I know that the wire GPU and screen and stuff do it, but how do they do it?

look at wire/lua/gmod_wire_screen/cl_init.lua
Mainly ENT:Draw

Could you give an example? all of that dosent really make sense. It’s all being called by something… could you just make a simple example for me? Like… draw.drawtext draws text ON THE SCREEN, but i want it to draw it in 3d space… serverside… I don’t think i understand what’s going on in there :smiley:

Check out how its done in wiremod. he essentially linked you to an example

It’s slightly more complicated than normal HUD drawing, so be sure to check out the examples.

I think he means the GMod Tower way. I’m unsure if they use wire though. I’d be surprised if they did!

They don’t use wire. But they use the same functions to make it into 3d space.

On the wiki there are almost no examples. Could someone explain what the functions in cam do? I sort of think that it has something to do with not actually rendering it in the world, but rendering it on your screen and making it seem like its being rendered in the world?

Just look at cam.Start3D2D( position, normal, scale )

‘position’ is the world position of the plane.
‘normal’ is the normal vector of the plane. It’s the direction where the plane faces to so to say. If you’d want the text to always face the player, just set it to (LocalPlayer():EyePos()-plane_position):GetNormal()
‘scale’ is probably the plane scale. Just set it to 1 to test, and scale it accordingly later on.

Example:
[lua]
function GM:HUDPaint()
local position = Vector(0,0,50) // draw the text 50 units above the world origin
local normal = LocalPlayer():EyePos()-position):GetNormal()
local scale = 1

cam.Start3D2D(  position,  normal,  scale )
	draw.DrawText("Test test test!", "ScoreboardText", 0, 0, Color(255,255,255,255),1)
cam.End3D2D()

end
[/lua]

Untested! I’ve never used the function myself, so my explanation might be wrong on some points. I’m not sure how the coordinates on the plane work for example.

EDIT: changed to use EyePos instead of GetPos for LocalPlayer. More accurate.

And if i were putting that in an eitity, where would i put it? Btw thanks alot :smiley:

Do try to read the wiki yourself first.

Never mind, IT WORKS! THANKS!

Does nobody search before posting? There was 2 threads about this. Yesterday.

http://www.facepunch.com/showthread.php?t=854140
http://www.facepunch.com/showthread.php?t=850789

Check posts date. (Note the thread was created with one post, not 10 posts, so you need to check the first post.)

One more thing if possible? How can i get the collision box size of a prop? like in e2 boxSize()?

I think that’s what you want.

Don’t provide evidence that sucks, the latest post dates on the 2 threads were within the last 2 days, the fact was nobody wants to search for something so simple. They want it all fed to them.

Not a retoast
Not a retoast
Not a retoast