• making cam 2d3d face player
    3 replies, posted
im trying to get my cam 2d3d to face player like a player tag but its above a npc [CODE] hook.Add("PostDrawOpaqueRenderables", "buble", function() for _, ent in pairs(ents.FindByClass(npcclass)) do ent:DrawModel() local Pos = ent:GetPos() local Ang = -LocalPlayer():EyeAngles() surface.SetFont("HUDNumber5") local text = npcname local TextWidth = surface.GetTextSize(text) Ang:RotateAroundAxis(Ang:Forward(), 90) --local TextAng = Ang --TextAng:RotateAroundAxis(TextAng:Right(), CurTime() * -180) cam.Start3D2D(Pos + Ang:Right() * -75, Ang, 0.2) draw.WordBox(2, -TextWidth*0.5, -20, text, "HUDNumber5", Color(50, 0, 0, 50), Color(255,255,255,255)) cam.End3D2D() end end) [/CODE] i got this code from somthing in dark rp and everything i try breaks it not sure what to do. right now if folows the player eye pos but its not facing them [editline]14th October 2014[/editline] this has been my only problem for a while and i just cant figure out how to do it! i need help
mabe i need to give it the players pos too?
[CODE] function ENT:Draw() self.Entity:DrawModel() local lpos = LocalPlayer():GetPos() local entity = LocalPlayer():GetEyeTrace().Entity if entity:IsValid() and lpos:Distance( entity:GetPos() ) < 160 then local p local ang = LocalPlayer():EyeAngles() p = entity:GetPos() + Vector(0,0,90) --+ math.sin(CurTime()*3)) cam.Start3D2D(p, Angle( 0, ang.y - 90, 90 ), 0.1) cam.End3D2D() end end end[/CODE] Here's a snippet of code I made for some tags above an entity. Take a look at how it's made. (I removed some elements of the code for easier navigation.)
thanks! just fixed my problem that was killing my sleep
Sorry, you need to Log In to post a reply to this thread.