public override void Deserialize(NetworkReader reader)
        {
            var messageVersion = reader.ReadPackedUInt32();

            if (this.version > messageVersion)
            {
                return;
            }

            this.version = messageVersion;
            this.lineRenderer.enabled = reader.ReadBoolean();
            int positionCount = (int)reader.ReadPackedUInt32();

            bool useWorldSpace = this.lineRenderer.useWorldSpace;

            for (int i = 0; i < positionCount; i++)
            {
                Lost.Caching.Vectors[i] = useWorldSpace ? NetworkTransformAnchor.TransformPosition(reader.ReadVector3()) : reader.ReadVector3();
            }

            this.lineRenderer.positionCount = positionCount;
            this.lineRenderer.SetPositions(Lost.Caching.Vectors);

            if (NetworkingManager.PrintDebugOutput)
            {
                Debug.Log($"NetworkLineRenderer {this.GetInstanceID()} deserialized {positionCount} positions.", this);
            }
        }
        public void PopulateNetworkIdentity(NetworkIdentity identity, bool updatePositionAndRotation)
        {
            identity.SetOwner(this.OwnerId, this.CanChangeOwner);
            identity.gameObject.SafeSetActive(this.IsEnabled);
            identity.ResourceName = identity.ResourceName;

            if (updatePositionAndRotation)
            {
                identity.transform.SetPositionAndRotation(
                    NetworkTransformAnchor.TransformPosition(this.Position),
                    NetworkTransformAnchor.TransformRotation(this.Rotation));
            }
        }
        public override void Deserialize(NetworkReader reader)
        {
            uint messageVersion = reader.ReadPackedUInt32();

            if (this.version > messageVersion)
            {
                return;
            }

            this.version = messageVersion;

            int  sent           = (int)reader.ReadPackedUInt32();
            bool sentPosition   = NetworkUtil.GetBit(sent, 0);
            bool sentRotation   = NetworkUtil.GetBit(sent, 1);
            bool sentScale      = NetworkUtil.GetBit(sent, 2);
            bool sentPhysics    = NetworkUtil.GetBit(sent, 3);
            bool useGravity     = NetworkUtil.GetBit(sent, 4);
            bool freezeRotation = NetworkUtil.GetBit(sent, 5);
            bool isKinematic    = NetworkUtil.GetBit(sent, 6);

            if (sentPosition)
            {
                Vector3 newDesiredPosition = NetworkTransformAnchor.TransformPosition(reader.ReadVector3());

                if (this.lastVelocityUpdateTime < 0.0f)
                {
                    this.estimatedVelocity = Vector3.zero;
                }
                else
                {
                    float timeSinceLastUpdate = Time.realtimeSinceStartup - this.lastVelocityUpdateTime;

                    if (timeSinceLastUpdate > 0.01)
                    {
                        this.estimatedVelocity = (newDesiredPosition - this.desiredPosition) / timeSinceLastUpdate;
                    }
                }

                this.desiredPosition        = newDesiredPosition;
                this.lastVelocityUpdateTime = Time.realtimeSinceStartup;
            }

            if (sentRotation)
            {
                this.desiredRotation = NetworkTransformAnchor.TransformRotation(reader.ReadQuaternion());
            }

            if (sentScale)
            {
                this.desiredScale = reader.ReadVector3();
            }

            // Early out and don't update physics if we're trying to get ownership of this object
            if (this.Identity.IsRequestingOwnership)
            {
                return;
            }

            if (sentPhysics)
            {
                this.rigidBody.velocity       = reader.ReadVector3();
                this.rigidBody.useGravity     = useGravity;
                this.rigidBody.freezeRotation = freezeRotation;
                this.rigidBody.isKinematic    = isKinematic;
            }
        }