Exemplo n.º 1
0
        public void Store(Grabbable grabbable, CharacterVR characterVR = null)
        {
            grabbable.Rigidbody.isKinematic = true;
            grabbable.Transform.parent      = transform;
            Vector3    attachPositionOffset = Vector3.zero;
            Quaternion attachRotationOffset = Quaternion.identity;

            grabbable.GetLocalAttachmentPositionAndRotation(transform, out attachPositionOffset, out attachRotationOffset, SlotType.name);
            grabbable.Transform.localPosition = -attachPositionOffset;
            grabbable.Transform.localRotation = Quaternion.Inverse(attachRotationOffset);

            if (!DataVR.Instance.grabbable.colliderEnabledWhenStored)
            {
                for (int i = 0; i < grabbable.Colliders.Length; i++)
                {
                    grabbable.Colliders[i].enabled = false;
                }
                if (characterVR)
                {
                    characterVR.RemoveNearInteractables(grabbable);                               //if fromInitialSpawn to avoid null reference remove on RemoveNearInteractables
                }
            }

            AttachedGrabbable = grabbable;
            AttachedGrabbable.SetOwnerSlot(this);
        }
Exemplo n.º 2
0
 private void OnEnable()
 {
     GetComponent <SphereCollider>().radius = DataVR.Instance.physicsProximityRadius;
     characterVR = GetComponentInParent <CharacterVR>();
 }