void Start()
 {
     vp = GetComponent <VRPickup>();
     if (hand && hand.attachedObject == null)
     {
         hand.AttachToHand(vp);
     }
 }
예제 #2
0
 public void AttachToHand(VRPickup pickup)
 {
     if (isHolding)
     {
         Debug.LogAssertion(gameObject.name + ": Trying to attach pickup on an unempty hand");
         return;
     }
     pickup.AttachToHand(this);
 }
예제 #3
0
 public bool RequestDetachFromHand(VRPickup requster)
 {
     if (requster == null || requster != m_attachedObject)
     {
         Debug.LogError(gameObject.name + ": Error on detaching pickup from hand: wrong or null pickup");
         return(false);
     }
     m_attachedObject = null;
     return(true);
 }
예제 #4
0
 public bool RequestAttachToHand(VRPickup requster)
 {
     if (attachedObject != null)
     {
         Debug.LogError(gameObject.name + ": Error on attaching pickup to hand: unempty hand");
         return(false);
     }
     m_attachedObject = requster;
     return(true);
 }
예제 #5
0
        void OnTriggerExit(Collider other)
        {
            VRPickup pickup = other.GetComponentInParent <VRPickup>();

            if (pickup)
            {
                if (!pickupsInTrigger.Contains(pickup))
                {
                    Debug.LogError(gameObject.name + ": An unlisted pickup exit the trigger: " + pickup);
                    return;
                }
                pickupsInTrigger.Remove(pickup);
            }
        }
예제 #6
0
        void OnTriggerEnter(Collider other)
        {
            VRPickup pickup = other.GetComponentInParent <VRPickup>();

            if (pickup)
            {
                if (pickupsInTrigger.Contains(pickup))
                {
                    Debug.LogError(gameObject.name + ": An pickup enters the trigger twice: " + pickup);
                    return;
                }
                pickupsInTrigger.Add(pickup);
            }
        }