Network Physics

A simple way to synchronize physics across clients is to enable the Sync Rigidbody option on the Network Object component. This will synchronize the state of the Rigidbody component across all clients.

The following rigidbody properties are synchronized:

  • isKinematic
  • velocity
  • angularVelocity
  • mass
  • drag
  • angularDrag

Sync Rigidbody

Only 3D rigidbodies are currently supported for synchronization.

Authoritative Client

Rigidbodies are simulated locally on every client, but the owner of the object has final authority over the state of the Rigidbody. If the objects drift apart due to physics simulation differences, the owner's state will be used to correct the state of the object.

If the object has no owner, authority is given to the master client.

Inter-Object Collisions

When two synched rigidbodies collide, it's best to simulate the physics of those two objects on the same client. This means that if the two objects that collided are owned by different clients, we want one client to take control of the other object. For this ownership transfer to be possible, it's important to enable the Allow Ownership Transfer flag on the Network Object component.

If ownership transfer is enabled on the object, the object ownership will be transferred to the owner of the object that has higher velocity.

Performance Considerations

Simulating physics can have a significant impact on performance, not to mention the additional bandwidth required to synchronize the state of the Rigidbody across all clients.

It is recommended to keep the number of synchronized Rigidbodies to a minimum. Ask yourself if it is truly important for all users to see the physics simulation consistently. If it doesn't matter to gameplay where the physics object's final resting state is, consider not synchronizing the Rigidbody.