Sign in to follow this  
Hans

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

Recommended Posts

Ah, thanks, this is what i need, but i dont get it to work. The demo in the tutorial also dont work for me.

Is it a bug?

Share this post


Link to post
Share on other sites

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?

 

Share this post


Link to post
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

Share this post


Link to post
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.

Example:

  • 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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.