Best way to check closest parts each frame out of 10K parts?

Hello, I’m currently curious to know the best most performant way to check the closest parts to the player out of 10K parts in total.

Currently, if I check the magnitude between the part and torso on each part, but it causes heavy lag.

1 Like

If the 10k parts dont move or regardless octrees or quadtrees should be a good place to start.

Found this resource which should help:

1 Like

Thank you for letting me know about this, I will make sure to check it out in a moment!