// Update is called once per frame
        void Update()
        {
            if (LocalState.RBTracking == localState && rb.velocity.magnitude == 0)
            {
                localState = LocalState.Resting;
                rotation.ClearReceivedMessages();
                rotation.enabled = true;
                if (transformPosition != null)
                {
                    transformPosition.ClearReceivedMessages();
                    transformPosition.enabled = true;
                }

                if (sendTransform != null)
                {
                    MessageListSend.RemoveSendBase(sendTransform);
                }
                MessageListSend.RemoveSendBase(sendRotation);
                sendTracking.SendMultipleMessages(false);
            }
        }
        public void HandleLocalTracking(bool state)
        {
            if (state)
            {
                localState = LocalState.Grabbed;
                rotation.ClearReceivedMessages();
                rotation.enabled = false;
                if (transformPosition != null)
                {
                    transformPosition.ClearReceivedMessages();
                    transformPosition.enabled = false;
                }
                boolState.enabled = false;
                if (type == ObjectType.Item)
                {
                    objectHandeling.SetActive(true);
                }
                else if (type == ObjectType.Door && UDPConnectionManager.singleton.DoorsUnlocked())
                {
                    objectHandeling.SetActive(true);
                }
                else if (type == ObjectType.Door && !UDPConnectionManager.singleton.DoorsUnlocked())
                {
                    objectHandeling.SetActive(false);
                }
                if (sendTransform != null)
                {
                    MessageListSend.AddSendBase(sendTransform);
                }
                MessageListSend.AddSendBase(sendRotation);
            }
            else
            {
                localState = LocalState.Ungrabbed;

                boolState.enabled = true;
                if (type == ObjectType.Item)
                {
                    objectHandeling.SetActive(true);
                }
                else if (type == ObjectType.Door && UDPConnectionManager.singleton.DoorsUnlocked())
                {
                    objectHandeling.SetActive(true);
                }
                else if (type == ObjectType.Door && !UDPConnectionManager.singleton.DoorsUnlocked())
                {
                    objectHandeling.SetActive(false);
                }

                if (rb.velocity.magnitude == 0.0f)
                {
                    localState = LocalState.Resting;
                    rotation.ClearReceivedMessages();
                    rotation.enabled = true;
                    if (transformPosition != null)
                    {
                        transformPosition.ClearReceivedMessages();
                        transformPosition.enabled = true;
                    }

                    if (sendTransform != null)
                    {
                        MessageListSend.RemoveSendBase(sendTransform);
                    }
                    MessageListSend.RemoveSendBase(sendRotation);
                }
                else
                {
                    localState = LocalState.RBTracking;
                }
            }
        }