Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    Dismiss Notice

limiting player FPS vision range ?

Discussion in 'Multiplayer Networking' started by jamesasrah, Oct 12, 2017.

  1. jamesasrah

    jamesasrah

    Joined:
    Sep 29, 2017
    Posts:
    4
    how can i make so that the player can't see other player until they got into my vision range??
     
  2. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    662
    One way might be to disable the renderer of the remote player object when it is beyond the range that you want it to be visible.
     
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    527
    I've never tried this, but I'm wondering if you could pull this off by using two cameras. Set the first camera with a far clipping plane set to the distance you want other players to appear, and the second camera with the near clipping plane starting at that same distance and going out further. Assign the players to their own layer, and use culling mask on the second camera to not display the players. You'd avoid having to recalculate range to all players in update, or however you'd do it, and avoid enabling/disabling renderers.

    I don't know if you'd get any graphic artifacts at the transition between the two cameras though.
     
  4. VergilUa

    VergilUa

    Joined:
    Dec 22, 2014
    Posts:
    196
    PerLayerCulling script (from asset store) is what you want. Note that this isn't "hack" proof concept.
     
  5. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    527
  6. VergilUa

    VergilUa

    Joined:
    Dec 22, 2014
    Posts:
    196
    With asset you can get extra functionality, like adequate display of layers, but yeah, you're right, it's layerCullDistances that does the trick.
     
  7. wobes1

    wobes1

    Joined:
    Mar 9, 2013
    Posts:
    278
    ProximityChecker component.
     
    VergilUa likes this.