Trouble with Traces

I have an invisible point entity called ent_jack_heat.
When it spawns, it’s supposed to do damage to all things near it (I already have an entity that does this just fine). It’s also supposed to light them on fire if they’re close enough. Problem is, I wan to run a trace for each object to determine whether or not there’s something between it and the point entity. If there is, I don’t want the entity to do its damage to that thing. I have this, but it doesn’t work. Help?

function ENT:Think()

local randfloat=math.Rand(0.75,1.25)

local HeatIntensity=((7-(CurTime()-self.StartTime))/7)

for key,found in pairs(ents.FindInSphere(self.Pos,6000)) do

	local Distance=(found:GetPos()-self.Pos):Length()
	local Damage=HeatIntensity*((6000-Distance)/6000)
	local class=found:GetClass()
	local foundpos=found:GetPos()
	local selfpos=self:GetPos()
	local trace={}
	local traceres=util.TraceLine(trace)

return true


EDIT: The idea is that this is some pretty intense heat, which harms you directly, and lights shit on fire if the heat is hot enough. Heat is electromagnetic radiation and as such, it gets stopped by things of sufficient opacity.


res.Entity is the entity hit by the trace, which is either an entity or NULL. You’d actually want to do something like:

and traceres.Entity == found then

Although it would be imperfect since anything on the ground would block them.

Traceres.Entity==found is the only way that has worked reliably so far. However, it seems to fail alot. Sometimes it completely fails to do the damage, and it seems to be the way I’m facing in relation to the entity. I suspect this is happening because if I stand a certain way, the trace will do something like go between my legs, and so it will fail to detect me and it will not do the damage. I just cant figure it out.