Trace not ignoring world?

I’m trying to get a trace line to ignore the world and be able to hit entities through the wall, no errors come up, but entities dont take damage through walls like they should.

If you could please look over my code for any mistakes it would be greatly appreciated.


Not sure but try

		local trace = util.TraceLine( {
			start = self.Owner:GetShootPos(),
                        endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * 999999999999999999999999999,
			filter = function( ent )
				if ( ent:GetClass() == "prop_physics" ) then 
					return true 
                        ignoreworld = true

I was never able to get this working with a normal trace personally, but you can try something like this:

function RayTrace( origin, dir, dist )
  local hitpos, hitent, hitnormal, closest, a, b, c, d

  closest = 10 ^ 31

  for k, v in pairs( ents.GetAll( ) ) do
    a, b, c = util.IntersectRayWithOBB( origin, dir, v:LocalToWorld( v:OBBCenter( ) ), v:GetAngles( ), v:OBBMins( ), v:OBBMaxs( ) )

    if a then
      d = a:Distance( origin )
      if d <= dist and d <= closest then
        closest = d
        hitpos = b
        hitnormal = c
        hitent = v

  return hitent, hitpos, hitnorm, closest

Barring errors, it would return the closest entity to the origin that the ray would intersect with. I don’t know if it would try to intersect with point entities, so the might be a need for some more conditions in the loop.