Syncing objects and properties
Let's play ball! Back in Chapter 8, Playing With Physics And Fire, we implemented various ball games in VR. Now, we have the means to make a multiplayer one. We will make a game similar to the Headshot game, which uses your head as the paddle. But after this exercise, feel free to go and build multiplayer versions of the Paddle Ball and/or Shooter Ball games, which use a hand controller to hold and move a paddle to hit or deflect the ball.
Also, since the objective here is to focus on the multiplayer networking considerations, we will leave out some details covered in the earlier chapter, such as sound effects, particles, and object pooling.
Setting up the headshot ball game
First, we'll add the cube paddle to the Avatar head as the one and only Collider on the Avatar:
- Drag a copy of the
Avatar
prefab into yourHierarchy
for editing - For each of its children (
Head, Glasses
), disable theCollider
if present - Create a new cube child of
Avatar
(Create | 3D Object | Cube...