World Origin Shifting
Creating massive multiplayer worlds
World origin shifting in coherence
Limitations
Quick start guide
using Coherence.Toolkit;
using UnityEngine;
[RequireComponent(typeof(CoherenceSync))]
public class PlayerShifter : MonoBehaviour
{
private CoherenceSync sync;
private void Awake()
{
sync = GetComponent<CoherenceSync>();
}
private void Update()
{
// We don't want to shift floating origin based on other player's position.
// The same can be achieved via components configuration in the CoherenceSync.
if (!sync.HasStateAuthority)
{
return;
}
// If player moves farther than 100 meters from the current floating origin
if (transform.position.magnitude > 100)
{
// Translate the floating origin so the player is back at (0, 0, 0)
sync.CoherenceBridge.TranslateFloatingOrigin(transform.position);
}
}
}Advanced settings
Was this helpful?

