Get entities near a position

It would be great if we had a function that would be similar to GetWorld():FindAll(), but only return entities in a certain range to a position.

Or even better would be having two different functions, one that is similar to ApplyRadialDamage and gets the entities that overlap to the area and another one that gets all entities that have their origin inside that area.

Would be great if these functions would work on client side too (unlike ApplyRadialDamage).

I can imagine doing a lot of great things with that.


I’ve realized at some point that what you are asking might actually be doable with ApplyRadialDamage (not sure about overlapping though). Basically you do that : ApplyRadialDamage with some special entity as a damageCauser. Then in health script you see that this entity was passed and instead of actually doing the damage - call whatever script with that causer passing there player (or entity) which received that fake damage . This way you can attach different logic that you want to be called to the “causers” and not actually receive damage.

Of course this only works if you are fine with modifying standard packages.

But yeah, of course better if API does that clearly, not some hacky mechanic depending on every other script respecting it…

I do that with ApplyRadialDamage, but thought it might be better to have an official solution. The issue with ApplyRadialDamage is that it is really performance heavy because it fires OnDamage on all scripts and all onDamage events.