public void LocalGrip(Hands hands, Hands.HandData data)
 {
     Release();
     localAvatar = hands;
     localHand   = data;
     holderId    = context.clientId;
     authorityId = context.authorityId;
     ownershipId++;
     authorityPacketId = 0;
     touching.GetComponent <BoxCollider>().isTrigger   = false;
     gameObject.GetComponent <Rigidbody>().isKinematic = true;
     data.grip        = gameObject;
     gameObject.layer = context.GetGripLayer();
     gameObject.transform.SetParent(data.transform, true);
     data.supports = context.FindSupports(data.grip);
     hands.AttachCube(ref data);
 }
    /*
     * Detach cube from any player who is holding it (local or remote).
     */
    public void Release()
    {
        if (!HasHolder())
        {
            return;
        }

        if (localAvatar)
        {
            localAvatar.DetachCube(ref localHand);
            touching.GetComponent <BoxCollider>().isTrigger = true;
        }

        if (remoteAvatar)
        {
            remoteAvatar.DetachCube(ref remoteHand);
        }

        localAvatar  = null;
        localHand    = null;
        remoteHand   = null;
        remoteAvatar = null;
        holderId     = Nobody;
    }