Adding multiplayer virtual reality
So far, we've learned about implementing multiplayer networking in Unity, but not specifically for VR. Now, we're ready for this. The way I've set things up, we do not need to change anything in our scene for it to work in VR.
Our avatar is just a head for a reason. In VR, the camera transform is controlled by the head pose from the HMD (Head-mounted Display) sensors. When the avatar is parented by the camera, it'll move in sync. While wearing the HMD, when you move your head and look around, the corresponding avatar in all the clients will move accordingly.
The Oculus Rift players
The scene presently has an instance of the standard FPSController
, which includes a Camera
component. We can use Unity 5's built-in VR support.
Navigate to File | Build Settings.... In the Build Settings dialog box, select Player Settings.... Then, under Other Settings, check off the Virtual Reality Supported checkbox.
The built-in Network Manager HUD is...