0
\$\begingroup\$

I'm wanting to try my hand at making an FPS multiplayer game. If I use arms as the first person model while playing, how do I set it up so that the other players see a full body model, and not just arms?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Hi TheOratog, and welcome to the GameDev SE. We work on a one-question-per-post model, so I've updated your post to focus on just the first question from your list. The second question will have different answers than the first question, so it needs to be asked separately. \$\endgroup\$
    – DMGregory
    Jul 3, 2021 at 2:33
  • \$\begingroup\$ My bad, had no idea. Thank you! \$\endgroup\$
    – TheOratog
    Jul 3, 2021 at 3:24

1 Answer 1

1
\$\begingroup\$

I have used this concept in one of my multiplayer game with Photon Pun2. where we just check whether photonView.IsMine or not to load what ever is required. This is a player setup script runs whenever multiplayer scene is loaded.

public GameObject[] FPS_Hands_ChildGameobjects;
    public GameObject[] Soldier_ChildGameobjects;

    public GameObject playerUIPrefab;
    private PlayerMovementController playerMovementController;

    public Camera FPSCamera;

    private Animator animator;

    private Shooting shooter;


    // Start is called before the first frame update
    void Start()
    {
        shooter = GetComponent<Shooting>();
        animator = GetComponent<Animator>();
        playerMovementController = GetComponent<PlayerMovementController>();

        if (photonView.IsMine)
        {
            //Activate FPS Hands, Deactivate Soldier
            foreach (GameObject gameObject in FPS_Hands_ChildGameobjects)
            {
                gameObject.SetActive(true);
            }

            foreach (GameObject gameObject in Soldier_ChildGameobjects)
            {
                gameObject.SetActive(false);
            }


            //Instantiate PlayerUI
            GameObject playerUIGameobject = Instantiate(playerUIPrefab);
            playerMovementController.joystick = playerUIGameobject.transform.Find("Fixed Joystick").GetComponent<Joystick>();
            playerMovementController.fixedTouchField = playerUIGameobject.transform.Find("RotationTouchField").GetComponent<FixedTouchField>();

            playerUIGameobject.transform.Find("FireButton").GetComponent<Button>().onClick.AddListener(()=>shooter.Fire());

            FPSCamera.enabled = true;

            animator.SetBool("IsSoldier",false);




        }
        else
        {

            //Activate Soldier, Deactivate FPS Hands
            foreach (GameObject gameObject in FPS_Hands_ChildGameobjects)
            {
                gameObject.SetActive(false);
            }

            foreach (GameObject gameObject in Soldier_ChildGameobjects)
            {
                gameObject.SetActive(true);
            }



           playerMovementController.enabled = false;
            GetComponent<RigidbodyFirstPersonController>().enabled = false;

            FPSCamera.enabled = false;

            animator.SetBool("IsSoldier", true); 

        }







    }
\$\endgroup\$
2
  • \$\begingroup\$ Thank you very much! Now where would I put this? On "each" player? or like an empty object in the multiplayer screen? \$\endgroup\$
    – TheOratog
    Jul 3, 2021 at 9:35
  • \$\begingroup\$ if you are also using photon than you have to have a player setup script on each player with photon view. \$\endgroup\$ Jul 3, 2021 at 13:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .