Filter out the world in a trace?

[lua]
local pos = tr.HitPos
local dir = tr.Normal
local trace = {}
trace.start = pos
trace.endpos = pos + dir * self.PenetrationDistance
trace.filter = tr.Entity
local tr3 = util.TraceLine(trace)
[/lua]
(Every variable has been defined, tr is a trace run a bit earlier.)

When I’m running this trace (tr3), it doesn’t seem to ignore the world even if tr.Entity is the world. tr3 DOES filter out tr.Entity if it ISN’T the world, but I need it to pass through the world as well if necessary.

The important part isn’t the bit with pos, dir, or tr. The trace works properly if tr hit a prop_physics or something else other than the world.

Am I doing something wrong? Is there a quick workaround that i could use?
Thanks!

hmm, if I’m understanding what you’re trying to do- trace through the world. Try and combine some of the CONTENTS_ enums.

I.E. [lua]
trace.mask = CONTENT_ + CONTENT_ + CONTECT_ etc[/lua]
I’m not sure if this is correct but hopefully this helps!

Er… using trace.mask allows you to tell what IS hit by the trace, not what is filtered out.
At any rate, I’m using a different method with regards to the world now, so this issue isn’t a big deal.

If anyone does know about why this occurs and an efficient workaround, their opinions are still greatly appreciated though. Thanks.

does it have to be in filter? if not you can just use

Im not sure if this is true but this is my concept from mapping experience.

Putting anything in the “Void” will result in the map failing to compile or will crash your game on post entity load.

I Think:
You are not allowed to do this, sending a trace out into the void may, im not 100% sure crash your game or just break the script cause it will just continue on forever unless its hitting something instantly. It traces till it hits something and because the void is infinity it will never return anything.

Traces have a fixed length.

Does adding the world entity to the trace filter do anything? I recall wanting to do this in the past but never getting anywhere with it.



tr.filter = { tr.Entity, Entity( 0 ) } --Or maybe GetWorldEntity( )


I don’t think so. MsgN(tr.Entity) and MsgN(tr3.Entity) both return the world, so adding the world to the filter twice shouldn’t accomplish anything. I originally tried to use CONTENTS_EMPTY as trace.mask but I don’t think that got me anywhere either. I might have had other bugs at the time, though.