I know I could use GetPartBoundsInRadius but this and other WorldRoot methods only detect BaseParts, I want to detect bones inside an area for optimizing a sea mesh but looping through 36 thousand + items of a table is not an option, because only 3 thousand or less will be animated.
To understand better the issue look at this:
This is how I’m animating my mesh right now, it works, and it’s optimized, but if I move that block in the image, the “rendering center”, the animated vertices can only decrease because my code detects the magnitude between every one of these ~2000 bones and the center, if it’s bigger than a certain value, “render distance”, then the vertex will not be animated anymore.
However doing the opposite, checking the magnitude between the ~36000 not animated bones and the center to animate them back if the magnitude is smaller than the render distance is not optimal and causes a lot of lag.
A solution I found would be actually iterating over these not animated bones but along a 10-frame interval, which reduces lag but creates this weird effect:
When moving in slower velocities the effect is smaller but still visible.
So, my final question is in the title, if you need any additional information please ask me, any help is appreciated.