Network Transform Sync
1. Overview
The spatial synchronization of objects in HoloMIT is handled by the Transform Sync components. These manage the propagation of position, rotation, and scale across the network.
2. NetworkTransformSyncBehaviour
This component synchronizes the Transform of a GameObject across the network. It relies on the Network ID system to identify the object across clients.
2.1. Sync Modes
- ServerOnly: Only the Master User (the first one in the session) can broadcast transform updates. Other clients will only receive and apply them.
- Any: Any client can call
DoSync(). Useful for collaborative objects where any user can move them.
2.2. Properties
Figure 1: Configuration of the Transform Sync component.
- Sync Automatically (bool): If enabled, the object will broadcast its transform at a fixed rate.
- Update Frequency (float): Number of updates per second (default: 10).
- Interpolate Updates (bool): If enabled, the component will smoothly transition between the last received positions, avoiding "jitter" at the cost of a tiny delay.
3. Implementation Guide
To make an object's transform networked:
- Ensure the object has a
NetworkIdBehaviourattached. - Attach
NetworkTransformSyncBehaviourif you want its movement to be synced. - Configure the Sync Mode based on who should "own" the movement (Master vs. Everyone).
4. Common Pitfalls
- Jittery Movement: If multiple clients are trying to sync the same object with
Mode = AnyandSyncAutomatically = true, they will fight for control. Ensure only one client is "driving" the object at a time. - Interpolation Delay: Higher interpolation values make movement smoother but increase the perceived latency. Adjust
UpdateFrequencyto find the right balance.