So I read another post a while back that said something like “To make your NPC’s more efficient and less laggy in masses. You can only render NPC’s and their animations only when a player can see them or is in X distance”
How is this done? Like lets say I only want to render a character when he’s in the camera view? How do you do that, do you constantly have a script running checking if player x Root part has the NPC root part within his camera view and at that point by rendering do they mean just make the character invisible and anchor him? Or is there some totally different other method to be used here?
Yea I know how to use a raycast to check if it’s visible. But I’m wondering, when people say “Render a unit or not” how exactly is that done? Do you remove and add character based on if a player can see him there. Maybe replace character with a placeholder invisible brick. And spawn character there, or do you just make all their parts transparent and anchor their root part? This way no physics are running afaik.
And perhaps also disable and re-enable their scripts when they’re active vs not active.
I think it would be best to do the animations locally and just have an unanimated zombie server side.
How do you do something for only 1 player? I’m recently coming back to ROBLOX and it’s been a while gotta get back up to speed.
Like do I just run a local script inside starter player scripts and run the animations there and it only applies to the person who had ran the script? At that point I then check if x player can see zombie.
So this way only the player who sees the zombie will render his animations and not also render all the other players who see zombies in different areas?