diff --git a/Basis/Packages/com.basis.tests/BasisObjectSyncNetworking.cs b/Basis/Packages/com.basis.tests/BasisObjectSyncNetworking.cs index ed78d08c5..173f17df3 100644 --- a/Basis/Packages/com.basis.tests/BasisObjectSyncNetworking.cs +++ b/Basis/Packages/com.basis.tests/BasisObjectSyncNetworking.cs @@ -83,7 +83,7 @@ public void OnEnable() _lastUpdateTime = Time.timeAsDouble; StartRemoteControl(); - BasisObjectSyncSystem.StartApplyRemoteData(this); + // BasisObjectSyncSystem.StartApplyRemoteData(this); } public void OnDisable() { @@ -119,13 +119,13 @@ private void OnOwnershipTransfer(string UniqueEntityID, ushort NetIdNewOwner, bo } if (IsLocalOwner == false) { - StartRemoteControl(); - // BasisObjectSyncSystem.StartApplyRemoteData(this); + // StartRemoteControl(); + // BasisObjectSyncSystem.StartApplyRemoteData(this); } else { - StopRemoteControl(); - // BasisObjectSyncSystem.StopApplyRemoteData(this); + StopRemoteControl(); + // BasisObjectSyncSystem.StopApplyRemoteData(this); } OwnedPickupSet(); } @@ -154,13 +154,24 @@ public void OnNetworkIdAdded(string uniqueId, ushort ushortId) OwnedPickupSet(); } } + public float Speed = 7; public void LateUpdate() { - if (IsLocalOwner && HasMessageIndexAssigned) + if (IsLocalOwner) { double timeAsDouble = Time.timeAsDouble; LateUpdateTime(timeAsDouble); } + else + { + float Output = Speed * Time.deltaTime; + Current.Rotation = Quaternion.Slerp(Current.Rotation, Next.Rotation, Output); + Current.Position = Vector3.Lerp(Current.Position, Next.Position, Output); + Current.Scale = Vector3.Lerp(Current.Scale, Next.Scale, Output); + + transform.SetLocalPositionAndRotation(Current.Position, Current.Rotation); + transform.localScale = Current.Scale; + } } public void LateUpdateTime(double DoubleTime) { @@ -180,9 +191,7 @@ public void OnNetworkMessageReceived(ushort PlayerID, ushort messageIndex, byte[ { if (HasMessageIndexAssigned && messageIndex == MessageIndex) { - Current = SerializationUtility.DeserializeValue(buffer, DataFormat); - transform.SetLocalPositionAndRotation(Current.Position, Current.Rotation); - transform.localScale = Current.Scale; + Next = SerializationUtility.DeserializeValue(buffer, DataFormat); } } public void StartRemoteControl()