Author Topic: Make my players characters invisible to other players characters...  (Read 957 times)

acronyte

  • Newbie
  • *
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 46
    • View Profile
Im trying to test out a lobby in my project, where players who have now connected can prepare their character for the actual game world...

The lobby itself is the first channel users join when connecting for the first time. After they have prepared their character , they can then enter the game world.

My issue is that everyone sees everyone else character when joining the lobby channel. Is there a way for tnet to hide or make invisible each players characters when they are in the lobby channel?


acronyte

  • Newbie
  • *
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: Make my players characters invisible to other players characters...
« Reply #1 on: April 10, 2017, 10:40:42 PM »
Nvm, I managed to sort it out by selecting every mesh (children) on the player character and setting them to enabled = false;

  1.                  if (!tno.isMine) {
  2.                         Renderer[] r = GetComponentsInChildren<Renderer> ();
  3.                         foreach (Renderer rend in r)
  4.                                 rend.enabled = false;
  5.                 }
  6.  

Dont know how practical this is, but it works...

acronyte

  • Newbie
  • *
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: Make my players characters invisible to other players characters...
« Reply #2 on: April 10, 2017, 10:46:50 PM »
I added a check if the player is in lobby....to hide the renderers when in the lobby

bool isinlobby;
isinlobby = true;

if (!tno.isMine && isinlobby) {
                        Renderer[] r = GetComponentsInChildren<Renderer> ();
                        foreach (Renderer rend in r)
                                rend.enabled = false;
                }
 

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Make my players characters invisible to other players characters...
« Reply #3 on: April 12, 2017, 10:10:13 AM »
Wouldn't disabling the gameobject be better than each renderer?

mythikos

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 18
    • View Profile
Re: Make my players characters invisible to other players characters...
« Reply #4 on: April 13, 2017, 06:49:52 PM »
Wouldn't disabling the gameobject be better than each renderer?

It would depend on the situation. If he just wants everyone hidden from each other, but allow each player to still use their objects, then disabling the render would be a decent option. If you don't want the player to use the object but still want it spawned and ready, then I think disabling the objects would be the best route. However, if you don't need the object, you could also simply remove it and using your game manager to spawn the player objects when they are needed (in your case, when they progress from the lobby).

acronyte

  • Newbie
  • *
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: Make my players characters invisible to other players characters...
« Reply #5 on: April 13, 2017, 09:54:02 PM »
Wouldn't disabling the gameobject be better than each renderer?

If he just wants everyone hidden from each other, but allow each player to still use their objects, then disabling the render would be a decent option.

Yes, this is pretty much what I was going after, My intention is to have a lobby where each players character is visible . The character needs to be visible , because the player needs to be able to prepare their character for entry to the 'game world' (separate channel).

The reason for multiple players in the lobby is to offer the ability to chat with each other m while preparing their character.

Thanks for the input...