I am loading a model on the client that is not seen by other players, so it’s only a visual for that player. A local script controls the model, since there is no need for a server script for this.
If a model only exists on the client, that model will always be rendered on the client, no matter what the streamingTargetRadius is. This makes it a problem to know WHEN I should load in this model. From what I have found, there is no way to get the render distance of a player in any form. Here are a few screenshots from a demo I made to show that the client will load stuff that only it sees. (Target radius is very low to show the effect)
One solution I considered was to go through some or all of the rendered parts in the workspace to see the furthest one actually rendered, and then set that to be an estimate for the render distance. However, this is very inefficient since it has to loop through every single part and calculate the distance, and also takes a hit on performance. Another solution was to just base off the render distance off the StreamingMinRadius, but this doesn’t make sense and is also confusing since the model would be invisible at a lot of times.
Or just group parts into models like how you’re supposed to with 3D modeling (which you already do?) and only compare the model’s bounding box position; and besides you don’t need to update it that often
Another potential solution that may or may not be more efficient than iterating through each individual part would be to use
:GetPartBoundsInRadius and get whatever doesn’t show up; however, do take it with a grain of salt
And instead of getting literally every single part, place an invisible hitbox inside each model and only scan for that instead
I didn’t really think too much about the fact that I didn’t have to update the value too often, so this could be a viable solution for now.
In this case, my current solution would be to check the distance of only some parts like we discussed, or even make a grid of invisible parts to be even more accurate. If you make the invisible grid on the server, then the client only sees the existence of parts that are in the render distance, therefore not having to check very many parts depending on how spaces out the grid is. Maybe even making the invisible parts only go one direction in a straight line, and then have the server attach it to the character when render distance needs to be checked.
I still want to try to find a solution of checking the render distance using a player module or something. Although, even if I am able to get graphics quality, which is probably the only value I could get from a player module, that can’t help with filtering enabled since they are different things.