Entity with no physics detectable by tracer?

Is there any way I can detect an entity which doesn’t have physics with util.TraceLine()? The trace goes to the entity’s center.

Another way is with distances, like this:[LUA]vector1:Distance(util.TraceLine({start = vector1, endpos = vector2}).HitPos) >= vector1:Distance(vector2)-1[/LUA]But I need this for compatibility sake, so it has to be done inside of the no physics entity.

Wouldnt it be easier to just do a: [lua]local ent = ents.FindByName(“prop_dynamic”,“prop_static”)
if ent then
– Insert Code here.[/lua]

Not only your code is completely irrelevant, but it’s also wrong. It’s nice that you want to help, but if you can’t code, there’s no point.

The problem here is: what do you want to do exactly? If your entity does not have physics, then there is no way to make a trace collide with it, since it doesn’t have a shape. From the code you posted, it seems like you are trying to figure out if a trace from one point to another successfully reaches that point without hitting any obstacle. There is a much simpler way to do that:

[lua]not util.TraceLine({start = vector1, endpos = vector2}).Hit[/lua]

Although I doubt that’s what you want to do. You should give more details, because “detecting an entity which doesn’t have physics with util.TraceLine()” doesn’t make much sense.

What exactly are you trying to do? See if Entity A has a clear LOS to Entity B, which is physicsless?

You can always simply do a trace from A’s position to B’s position, then check if the distance from the trace’s endpos to A is the same distance as the distance from B’s position to A.

Or you can use TraceRes.Fraction; pretty certain that would work here, too. Never used it myself, though.

That’s really the simplest way. :science: That, or you can check if Fraction is equal to 1, but that’s basically the same.

Sorry, I suck at describing. Anyway thats sorta what I was looking for, thanks.