private void ReceivedClientSpatial(Message message)
        {
            if (GetEntitySpatialCompleted != null)
            {
                var args = new ClientSpatialEventArgs();

                // Read the message
                client.Reader.ReadNewMessage(message);
                client.Reader.ReadByte();

                // Find out how many clients that are included in the message
                byte clients = client.Reader.ReadByte();

                // Initialize and retrieve all client spatial data
                args.Entity = new EntitySpatial[clients];

                for (byte i = 0; i < clients; i++)
                {
                    var data = new EntitySpatial();
                    data.Id = client.Reader.ReadUInt16();
                    data.TimeStamp = client.Reader.ReadTimeStamp();
                    data.Position = messageHelper.ReadVector3(client.Reader);
                    data.Velocity = messageHelper.ReadVector3(client.Reader);
                    data.Angle = messageHelper.ReadVector3(client.Reader);

                    args.Entity[i] = data;
                }

                GetEntitySpatialCompleted(this, args);
            }
        }
        public void AddSpatial(ushort id, EntitySpatial spatial)
        {
            Entities[id].SpatialData.Add(spatial);

            // Keep a maximum of 100 entries
            if (Entities[id].SpatialData.Count > 100)
            {
                Entities[id].SpatialData.RemoveAt(0);
            }
        }
        private bool HasSpatialData(EntitySpatial spatial)
        {
            if (spatial.Position == Vector3.Zero &&
                spatial.Velocity == Vector3.Zero &&
                spatial.Angle == Vector3.Zero)
            {
                return false;
            }

            return true;
        }
        private void ReceivedEntitySpatial(Message message)
        {
            var clientId = connectionIds[message.ClientId];

            if (!entityHelper.Entities.ContainsKey(clientId))
            {
                return;
            }

            server.Reader.ReadNewMessage(message);
            server.Reader.ReadByte();

            var spatial = new EntitySpatial();
            spatial.Id = clientId;
            spatial.TimeStamp = server.Reader.ReadTimeStamp();
            spatial.Position = messageHelper.ReadVector3(server.Reader);
            spatial.Velocity = messageHelper.ReadVector3(server.Reader);
            spatial.Angle = messageHelper.ReadVector3(server.Reader);

            entityHelper.AddSpatial(clientId, spatial);
        }