Tracing between two entities failing

Tracing always returns WorldSpawn. What am I doing wrong?

[lua]function ENT:HostilesVisible()

local att = "eyes"
local eyes = self:GetAttachment(self:LookupAttachment(att))

local dir = (self.Enemy:GetPos() - eyes.Pos):GetNormal(); -- replace with eyepos if you want
local canSee = dir:Dot( self:GetForward() ) > 0.8; -- -1 is directly opposite, 1 is self:GetForward(), 0 is orthogonal

local traceRes = util.QuickTrace( eyes.Pos, self.Enemy:GetPos(), self )
print(traceRes.Entity)
local target = traceRes.Entity
if (canSee && (target:IsPlayer()) ) then
	return true
else
	return false
end
return false

end[/lua]

If you are using this on a prop, then


    local eyes = self:GetAttachment(self:LookupAttachment(att))

will mess it up.

If not, refer to my code.



local function IsPlayerVisible(ply)
    if not IsValid(ply) then return false end
    local plyPos, _ = ply:GetBonePosition(ply:LookupBone("ValveBiped.Bip01_Head1") or 12)
    local traceRes = {
        start = LocalPlayer():EyePos(),
        endpos = plyPos,
        filter = LocalPlayer()
    }
    local trace = util.TraceLine(traceRes)
    if trace.Entity and trace.Entity == ply then return true end
    return false
end


–edit: and to find the difference of the angles, use math.abs(math.AngleDifference(trace.y, real.y)) + math.abs(math.AngleDifference(trace.p, real.p))