This document is about: FUSION 2-SHARED
SWITCH TO

Physics

Since Fusion 2.1 NetworkTransform supports the use of Rigidbodies in both Shared and Client-Server modes.

Two different approaches are built-in:

  • Forecast : uses extrapolation to place physics objects in the local time of all players. They are smoothly interactable from all clients.

  • Forecast Disabled: synchronizes physics objects from their authority to other clients in the same way non-physics objects are synchronised. Except on the authority these objects will be in remote time and their rigidbodies set to kinematic. This is most suitable for non-interactable physics in client-server games.

Network Project Config - Global Settings

Physics Forecast

This is the global configuration for Forecast Physics. This must be enabled to allow any Forecast Physics extrapolation. When unchecked physics is synchronised to all proxies in remote time. When checked Forecast Physics is controlled per NetworkTransform.

Network Transform Control Settings

Forecast Physics Enabled

A per object option to control forecast physics. Only effective when Forecast Physics is enabled in the NetworkProjectConfig.

Forecast

Forecast Physics extrapolates the position received over the network to place physics objects in the local time of all players. In this case all clients run full physics locally and reconcile the local physics results with the extrapolated positions. This enables smooth interactions between physics objects.

For Forecast objects to move smoothly the Unity Rigidbody should have interpolation enabled:

Rigidbody set to Interpolate.

Recent versions of Unity support running physics in Update() rather than FixedUpdate(). This is not supported by Forecast Physics.

If a physics object is controlled by a player, for example a car, better results are generally obtained by sending the player inputs to all clients and having all clients run both the object control code and physics locally.

Limitations

The extrapolation of the received data is not aware of obstacles in the world. As the physics run locally, objects will not incorrectly enter walls, or other obstacles. However objects in motion will not appear to be in exactly the same position for all clients. This will be most noticable when a physics object has a sharp change of direction e.g. a ball bounces off the floor.

The quality of the networked physics will drop as a clients ping time increases, as with all networking code.

Forecast Disabled

This synchronizes physics objects from their authority to other clients in the same way non-physics objects are synchronised. On proxies, by default, we set their rigidbodies to kinematic, so that all physics interactions are handled on the authority.

It is most suitable for non-interactable physics in client-server games, for example, where characters can not push physics objects. The proxies are in remote time. If physics interactions are enabled, they will not, in general, be smooth.

The behaviour is changed in Fusion 2.1 from Fusion 2.0, which did not set proxy rigidbodies to kinematic. To behave identically to Fusion 2.0, set the property NetworkTransform.PhysicsSettings.SetForecastDisabledProxyRigidbodiesToKinematic to false in code.

Back to top