Making a hud that allways faces the client (Entity)

Is there a way of making a hud on a entity that allways faces the client? I’ve done alittle so far, but it only gets the LocalPlayers EyeAngle…

[lua]
include(“shared.lua”)

function ENT:Initialize() end
function ENT:Draw()
self:DrawModel()

local Pos, Ang = self:GetPos() + Vector( 0, 0, 8 ), Angle(0, EyeAngles().y, 0) -- sets the EyeAngle.
Ang:RotateAroundAxis( Ang:Right(), 90)
Ang:RotateAroundAxis( Ang:Up(), -90)

surface.SetFont("HUDNumber5")
local TextWidth = surface.GetTextSize("Baking bucket")

if Pos:Distance(LocalPlayer():GetPos()) < 100 then -- If you go too far away, it wont display.
	cam.Start3D2D(Pos + Ang:Up(), Ang, 0.11)
		draw.RoundedBox(4, -TextWidth*0.5 - 3, -86, TextWidth + 12, 30, Color(0, 0, 0, 230))
		draw.WordBox(2, -TextWidth*0.5, -90, "Baking bucket", "HUDNumber5", Color(0, 0, 0, 0), Color(255,255,255,255))
	cam.End3D2D()
end

end
function ENT:Think() end
[/lua]

http://puu.sh/7jGrR.jpg

As you see here the hud just turns too much, witch look dumb.

Anyone :slight_smile: Help is really appreciated!

Angle(0, EyeAngles().y, 90)

Thanks, but im not looking for make it look like this… http://puu.sh/7jHcx.jpg

Just play with the angle… Angle(0, EyeAngles().y, 0) removed the 90

The angles roll value will do that, I left that for you to play with :stuck_out_tongue:

Lol. Anyway, what i mean it the post is that i want the hud to face the pos of client.

Forgot to add this in:
[lua]
local pos = ent:GetPos()
local ang = EyeAngles()

ang:RotateAroundAxis(ang:Forward(), 90)
ang:RotateAroundAxis(ang:Right(), 90)

cam.Start3D2D(pos, Angle(0, ang.y, 90), 1)
–draw
cam.End3D2D()
[/lua]

Thats not what i said!? What you made their is the hud getting the EyeAngle of a player, and not a hud that faces the player pos??

That code will make the text constantly face your eyes.

Yes, but thats not what im asking for.

[editline]5th March 2014[/editline]

Im asking for a way, to make the HUD face the current pos of a player?

Sorry I have no idea what you’re talking about.

Show an example with a picture or explain it differently

http://puu.sh/7jJSV.png

Get it now?

[editline]5th March 2014[/editline]

The hud is facing the pos of the player

Yeah I see what you mean now.

This should do the trick “(entPos-plyPos):Angle()”

You could probably use ply:GetShootPos()

Edit: Nevermind…

I had to do some changes thoug :smiley:
[lua]
local RotationAng = (self:GetPos()-LocalPlayer():GetPos()):Angle()
local Pos, Ang = self:GetPos() + Vector( 0, 0, 8 ), Angle(0, RotationAng.y, 0)
[/lua]

That works! :smiley: Thank you, can you explain what happens? What is :Angle() for?

Vector:Angle() will convert the vector into an angle, you can just check the wiki for a reference located here.

Thx, can i convert an vector in to an angle then?

That’s what you just did.

Woops, i meant An Angle to vector :smiley:

Why would you have to do that?

Everything you need is already there.