How to render stuff on one camera but not on others

In multiplayer games, the player only sees his hands and weapon special meshes, but the other players see his full character but they don’t see the hands and weapon.
I have no clue on how to do it :roll_eyes:

You can assign an object to a layer, and assign what layers are rendered by a camera.

Yes, well, that’s cool but!

Also the other players will have the same stuff going on, there is the problem.

Let’s say that camera 1 on player 1 can see layer A (hands) but can’t see layer B (body).
Then I have to make camera of player 2 able to see B but not A, so he will see body of player 1 but not the special mesh for hands.
But in this case player 2 will see his body but not his hands.

This is why I opened the thread :smile:

I don’t know man.

I think you need to set up a camera that will handle all things player 1, a camera for all things player 2 etc.

What kind of multiplayer is this if you need several cameras to solve these issues. Is this on 1 PC?

Because in multiplayers everyone is running on different application and when you instantiate stuff to the network you just do like that:

if(itsme)
{
    // do stuff with my camera
}
else
{
    // do stuff with others people cameras
}

Of course it’s a normal multi pc game connected through internet.

So watch: at the moment, I have 2 cameras linked to my vehicle, one external and one internal.
In my noobness, at the moment, when the player switches to the internal camera, I disable the rendering of a couple of meshes and activate the cockpit mesh.
And of course when the player switches to the external camera the opposite happens.

Now, are you telling me that each player will see his own world?
And in this case, let’s say that I blast a building, of course this has to happen on all the players’ scene!
How is that?

I mean, by default each player sees his own world, and only commands sent on purpose will update stuff on all clients?
Sorry for these noob questions but as you can guess it’s my first approach to multi.

If you have 8 players connected there will be 8 cameras in the scene but every player will have different cameras enabled. For example:

  1. You connect as a first player, instantiate camera, go through every camera in the scene, well but you are only the one so enable only 1 camera.
  2. Second player connects, instantiates new camera and player 1 camera, he enables his camera and disables player 1 camera.
  3. Player 3 enables his camera, disables player 1 and player 2 camera.

and so on.

It applies to lots of stuff, for example if you have 8 players and some GUI for each player, that means that there will be 8 GUI files in the scene, so for each player you have to enable only 1 GUI for him

That all comes as I said to:

void Start()
{
    if(itsme)
    {
        this.enabled = true;
    }
    else
    {
        this.enabled = false;
    }
}

In multiplayer there are things you instantiate to network and things that you instantiate only for player. It only depends on what you want every one to see and what only player should see.

Now it’s more clear, I know I’ll have to make some more scripts for what you said.
I’ll have to erase all cockpits of other vehicles and GUIs and cameras of everybody except the player’s one.

Thank you very much for your kind help :slight_smile:

Bro please tell how to it.

Bro

1 Like