I’m working on an out-of-the-ordinary implementation of Photon Pun 2, where I’m instantiating a local player gameObject (local client only), and a corresponding remote player Gameobject (all clients), which follows the movements of it’s local player. I’d like to make it so that the local player’s camera culls the remote player gameObject owned by the local player, while still allowing that same remote player gamoObject to be viewed by players on other clients.
I’ve tried disabling mesh renderers, but that disables them across the Photon network. So, I’ve decided to attempt culling because it doesn’t cause any networked changes to the remote player object. Instead it would only effect how the local player renders their own remote player GameObject.
Is there a way to cull a single GameObject without causing it to become invisible across all clients?
I’m aware of using layers, but if I change the layer for the remote player’s mesh renderers, it will change them across the network, making it invisible on all clients, which is what I’m trying to avoid.
Update:
Still unsolved, but I’ve started looking into distance culling. I set up a layer and layermask for the remote players, and I want to cull if less than 0.5f from the camera. So far, I can only cull if farther than 0.5f. So, I’m looking for a way to cull near plane instead of far plane.
Camera camera = GetComponent<Camera>();
float[] distances = new float[32];
distances[16] = 0.5f;
camera.layerCullDistances = distances;
The code snippet above works backwards from what I’m trying to do.