Instead of looping through every single item and making sure’s it’s within range every 0.05 seconds, what you could do is use Region3s (i suggest EgoMoose’s Rotated Region3 Module, as it supports cylinders and balls, which make radius checking easier) every few seconds (4-5 seconds would be fine) and determine what items are in an acceptable range, cache these items in a separate table.
Then, on your 0.05 second loop, you can use the cached items that are verified to be close from the Region3 cache. This will speed things up quite a bit, since you no longer need to constantly check every single item, rather just the nearby ones.
i don’t know enough about oct-trees to suggest anything there.