I've been working on 3d2d for entities just for some practice and i've reached a problem where my panel isnt facing the right way all the time
Facing on a angle, working
[IMG]http://i.imgur.com/zzFdXlr.png[/IMG]
Facing straight at me, not working
[IMG]http://i.imgur.com/GYCBm9A.png[/IMG]
If you know how i can fix this please tell
[LUA]
function ENT:Draw()
self:DrawModel()
self:SetColor(Color(255, 255, 255, 255))
self:SetPos(self:GetPos(x),self:GetPos(y),self:GetPos(z))
local ply = LocalPlayer()
local dist = (ply:GetShootPos() - self:GetPos()):Length()
if (dist > 750) then return end
local ang = (self:GetPos() - ply:GetShootPos())
local tr = util.GetPlayerTrace(ply, ang)
local tr = util.TraceLine(tr)
if (tr.Entity != self) and (tr.Entity:GetClass() != "ply") then return end
local fix_angles = self:GetAngles()
local fix_rotation = Vector(270, 90, -5)
fix_angles:RotateAroundAxis(fix_angles:Right(), fix_rotation.x)
fix_angles:RotateAroundAxis(fix_angles:Up(), fix_rotation.y)
fix_angles:RotateAroundAxis(fix_angles:Forward(), fix_rotation.z)
local target_pos = self:GetPos() + (Vector(10,8,3))
cam.Start3D2D(target_pos, fix_angles, 0.120)
local t = {}
t.start = ply:GetShootPos()
t.endpos = ply:GetAimVector() * 32 + t.start
t.filter = player
local tr = util.TraceLine(t)
local pos = self:WorldToLocal(tr.HitPos)
surface.SetDrawColor(0, 200, 0, 255)
surface.DrawRect(-71, -75, 165, 135)
surface.SetDrawColor(0, 0, 0, 255)
surface.DrawOutlinedRect(-71, -75, 165, 135)
draw.SimpleText("Main Screen", "ChatFont", 0, -65, Color(27, 255, 129, 255), 1, 1)
cam.End3D2D()
end
[/LUA]
you're adding the vector to the GetPos, so its different depending on the Pos of the entity
Sorry, you need to Log In to post a reply to this thread.