Jump to content

[solved] make mesh, sprite invisible for just one camera


Recommended Posts

If I get it right its not possible to show one komplex scene in two cameras completely and just one or few meshes in the scene are invisible for one of two cameras.
The only way I see is to add more cameras which show/overlay the 'secret' meshes. Right?


Link to comment
Share on other sites

It is possible. This is the goal of the layerMask: you can have objects visible only for one camera and some visible for both.

For instance let's say that camera1.layerMask == 1 and camera2.LayerMask == 2

  • a mesh with a layerMask == 1 will only be on camera1
  • a mesh with a layerMask == 2 will only be on camera2
  • a mesh with a layerMask == 3 will be on both

The layerMask is used to do a bitwise comparison

Link to comment
Share on other sites

So I need 4 cameras for a local coop game with two players who want to see the whole world and each his crosshair/gun sight.


  • player01:
    • camera1 with layerMask == 3  // world
    • camera2 with layerMask == 1 // crosshair for player01
  • player02:
    • camera3 with layerMask == 3 // world
    • camera4 with layerMask == 2 // crosshair for player02

I am right?

How strongly a new camera affects the performance? Does this kill performance on mass for a 4 player coop game?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...