Problème Cam3D2D

Pol Epie

Membre
Membre
21 Mars 2020
1
0
7
Bonsoir, je code un NPC et j'ai trouver un bout de code pour afficher un texte au dessus de sa tête mais sur certain endroit de la map il disparaît. Une idée sur comment corriger ça ?

Code:
hook.Add("PostDrawOpaqueRenderables", "NPCImm", function()
    for _, ent in pairs (ents.FindByClass("elypse_immo")) do
        if ent:GetPos():Distance(LocalPlayer():GetPos()) < 500 then
            local offset = Vector( 0, 0, 85 )
            local ang = LocalPlayer():EyeAngles()
            local pos = LocalPlayer():GetPos() + offset + ang:Up()
            ang:RotateAroundAxis( ang:Forward(), 90)
            ang:RotateAroundAxis( ang:Right(), 90)
            cam.Start3D2D(ent:GetPos()+ent:GetUp()*76, ang, 0.10)
                draw.SimpleTextOutlined( "Agent Immobilier", "NameNPC", 0, 0, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 0, Color(255,255,255,255) )
            cam.End3D2D()
        end
    end
end)