/// <summary> /// Updates peers on the position, scale, and rotation of this transmission object. /// </summary> public void Synchronize() { if (_isMine) { //update relative: localPosition = TransformUtilities.LocalPosition(Transmission.Instance.sharedOrigin.position, Transmission.Instance.sharedOrigin.rotation, transform.position); rotationOffset = TransformUtilities.GetRotationOffset(Transmission.Instance.sharedOrigin.rotation, transform.rotation); //send out the change to this transform: Transmission.Send(new TransformSyncMessage(this)); } }
//Init: private void Awake() { //sets: localPosition = TransformUtilities.LocalPosition(Transmission.Instance.sharedOrigin.position, Transmission.Instance.sharedOrigin.rotation, transform.position); rotationOffset = TransformUtilities.GetRotationOffset(Transmission.Instance.sharedOrigin.rotation, transform.rotation); targetScale = transform.localScale; //catalog: _all.Add(guid, this); //hooks: Transmission.Instance.OnPeerFound.AddListener(HandlePeerFound); Transmission.Instance.OnTransformSync.AddListener(HandleTransformSync); Transmission.Instance.OnOwnershipGained.AddListener(HandleOwnershipGained); Transmission.Instance.OnOwnershipTransferDenied.AddListener(HandleOwnershipTransferDenied); StartCoroutine("ShareTransformStatus"); }