Forum Discussion

2 Replies

  • Hi iByte​ ! Within the "BaseNetworkPlayer.cs" script, there's a "OnNetworkSpawn()" function where the head & hand origins are initialized via linking with OVRCameraRig's center eye & controller anchors - which their positions & rotations will sync across multiplayer.

    Hope this clarifies! :)

    public override void OnNetworkSpawn()
            {
                base.OnNetworkSpawn();
                if (IsOwner)
                {
                    // Set Local Player.
                    LocalPlayer = this;
                    XRINetworkGameManager.Instance.LocalPlayerConnected(NetworkObject.OwnerClientId);
    
                    // Get Origin and set head.
                    OVRCameraRig rig = FindFirstObjectByType<OVRCameraRig>();
                    if (rig != null)
                    {
                        m_HeadOrigin = rig.centerEyeAnchor;
                        SetHandOrigins(rig.leftControllerAnchor, rig.rightControllerAnchor);
                    }
                    else
                    {
                        Utils.Log("No XR Rig Available", 1);
                    }
    
                    SetupLocalPlayer();
                }
                CompleteSetup();
            }

     

    • iByte's avatar
      iByte
      Start Member

      Thank you for the reply. I’m working through this because I’m trying to do the same thing with Unity’s tabletop multiplayer mixed reality template the same way Valem did using the VR multiplayer template. I’ve got the player joining using the prefab from the golf game, but I’m still having some issues trying to get the UI to respond to Ray or poke interactions.

→ Find helpful resources to begin your development journey in Getting Started

→ Get the latest information about HorizonOS development in News & Announcements.

→ Access Start program mentor videos and share knowledge, tutorials, and videos in Community Resources.

→ Get support or provide help in Questions & Discussions.

→ Show off your work in What I’m Building to get feedback and find playtesters.

→ Looking for documentation?  Developer Docs

→ Looking for account support?  Support Center

→ Looking for the previous forum?  Forum Archive

→ Looking to join the Start program? Apply here.

 

Recent Discussions