NetworkRigidbody
The NetworkRigidbody component synchronizes the Rigidbody properties of a game object across the network. This component is useful when using non-kinematic rigidbodies, which apply continuous forces such as gravity.
NetworkRigidbody includes all the features of NetworkTransform, so do not use both NetworkTransform and NetworkRigidbody on the same object. You should choose one or the other.
- For objects using Rigidbody: Use NetworkRigidbody
- For objects using only Transform: Use NetworkTransform :::
Component Types
NetworkRigidbody offers four types.
For 3D physics
- NetworkRigidbodyReliable: Higher bandwidth, typical latency
- NetworkRigidbodyUnreliable: Lower bandwidth, very low latency
For 2D physics
- NetworkRigidbodyReliable2D: Higher bandwidth, typical latency
- NetworkRigidbodyUnreliable2D: Lower bandwidth, very low latency
It is recommended to use the Reliable version unless you specifically need very low latency. :::
Basic Setup
To use the NetworkRigidbody component, the following are required.
- NetworkIdentity component
- Rigidbody / Rigidbody2D component
Inspector Settings
Sync Settings
Selective Sync
Selective Sync: Choose which Transform properties to synchronize across the network:
- Sync Position
- true: The position of the game object will be synchronized over the network.
- false: Position synchronization is disabled; local position changes will not be sent to other clients.
- Sync Rotation
- true: The rotation of the game object will be synchronized over the network.
- false: Rotation synchronization is disabled; local rotation changes will not be sent to other clients.
- Sync Scale
- true: The scale of the game object will be synchronized over the network.
- false: Scale synchronization is disabled; local scale changes will not be sent to other clients.
Interpolation
Interpolation controls the smooth transition between received Transform values over the network.
- Interpolate Position
- true: Position changes are smoothly interpolated.
- false: Position changes are applied immediately.
- Interpolate Rotation
- true: Rotation changes are smoothly interpolated.
- false: Rotation changes are applied immediately.
- Interpolate Scale
- true: Scale changes are smoothly interpolated.
- false: Scale changes are applied immediately.
Coordinate Space
Sets the reference coordinate system for Transform synchronization.
Local
- Uses a relative coordinate system based on the parent object.
- Useful when the object is a child of another object.
- The object will be synchronized relative to the movement of the parent object.
World
- Uses absolute coordinates based on the world coordinate system.
- Suitable for objects that move independently.
- The object will be synchronized to an absolute position, regardless of the parent object.
- It is recommended not to change Selective Sync settings during runtime.
- Typically, synchronize Position and Rotation, and only enable Scale when necessary.
- To ensure smooth movement, it is recommended to enable Interpolation for Position and Rotation. :::