Proper way to instantiate players in VR using PUN

Options
I'm developing multiplayer game for HTC vive and looking for best practice of instantiating players in the network.

So far my setup is to have PlayerController that will instantiate (not on network) steamVR cameraRig prefab if isMine is true. And I instantiate seperated 3 GO that take transform of the both controllers and head.

So I want to instantiate playerPrefab for every player that joins the network so their movements (head, 2controllers) would need to be updated by that 3 GO I mentioned earlier.

Is this good approach? If so how can I achieve this last step of updating position?

Thanks

Comments

  • jeanfabre
    Options
    Hi,

    You'll need to have a component that watch the tc vive gameobject representing the head and save the position and rotation, to synch it manually over the network using OnPhotonSerializeView


    Do you know how to use OnPhotonSerializeView?

    otherwise, yes, you'll need to have a proxy for your htc vive system, it's a lot easier than trying to modify the prefab to make it network, since you will need to have a representation of other players that doesn't exists locally.

    Bye,

    Jean
  • I've just finished adding initial VR support, you can see the stuff at..

    https://www.youtube.com/watch?v=1QuAwXWxPZA

    Basically we have a network player representation, it's job is to lock on to the camera rig and update all other players (via RPC) in regards to the controllers and head position/rotation (and buttons, teleport beam, etc.)

    This represents both local (sending and showing local lag) and remote (receiving and visualising) depending on how it's instantied. They are instigated when you join a room, if your master then it's local

    Tbh, we use RPC's for everything as we wanted full control over sending and receiving logic (and "in game" ownership when grabbing objects)

    James