I currently have this:
ang = LocalPlayer():EyeAngles()
cam.Start3D2D( Vector(0, 0, 0),Angle(0,ang.y-90,90), 1 )
surface.SetTextColor( 255, 255, 255, 255 )
surface.SetTextPos( 0, 0 )
draw.DrawText("Hello World Test" )
cam.End3D2D()
and it rotates on the x axis fine however id like it to rotate if the player is below it or above it.
basically the roll axis / z axis ( i think)
Any help is appreciated
function angto(target)
local ply = LocalPlayer()
local vec = (ply:GetPos() - target:GetPos()):GetNormalized()
local ang = vec:Angle()
return ang
end
local lookat = angto(v).y
Hope this helps
I believe this should work.
local ang = LocalPlayer():EyeAngles()
ang:RotateAroundAxis(ang:Forward(),90)
ang:RotateAroundAxis(ang:Right(),90)
Then make it a local function if you have a problem with that...
local function angto(target)
local ply = LocalPlayer()
local vec = (ply:GetPos() - target:GetPos()):GetNormalized()
local ang = vec:Angle()
return ang
end
Count how many functions your calling compared to the method I suggested.
Still new to lua, just thought I had an idea, besides wouldnt your way make the cam3d2d face wherever the player faces, not actually at them unless the player is looking at it?
You win that I guess
You just need replace the control-rotation angle with the angle of the position from a bone of the model (Problem is not every model will have the same set of bones).
I tried this with yaw, but not pitch or roll. Should still work though. I choose this method because it's easy to understand.
local ang = EyeAngles()
for k,v in pairs(ang) do ang[k] = v + 180 end
local dir = ang:Forward()
Then, just use the normal (dir) for the direction of the text.
Sorry, you need to Log In to post a reply to this thread.