Exactly what it says on the can, I want to find all entities colliding with the owner of a SWEP, sort out NPCs, and deal damage to them and push them away. How would I go about doing this?
I think it might be much easier just to check if they are a certain distance away, if you used a small enough distance it would appear to only work if they’re colliding anyway.
I’m not completely certain of my strategy, but I’d experiment with **[Util.TraceEntity
Then you’d also have to take the size of the bounding box into account. Just checking the distance between entity origins will be quite inaccurate.
How would I get the entities nearest to the player in order to do either of those?
Edit: Is it possible to use Ents.FindInBox( vector, vector ) and for all of them, deal damage?
That is an option, but I think ents.FindInBox only looks at entity origins, not at their entire bounding box.
Well, I don’t see how I can use tracing to find something without having serious lag, unless I can apply some sort of enlarged mask to it or something.
You could combine the two. First a cheap distance check, and then see if it’s worth doing a trace. This is actually the purpose of a bounding box: it’s a cheap way to check if it’s worth doing a more accurate check.
He could check the distance from the bounding box.