Example #1
0
 public void PickupObject()
 {
     if (transform.parent != null && transform.parent.GetComponent <ObjectSnapArea>())
     {
         transform.parent.GetComponent <ObjectSnapArea>().currSnappedObj = null;
     }
     GetComponent <Rigidbody>().useGravity  = false;
     GetComponent <Rigidbody>().isKinematic = true;
     transform.SetParent(Singletons.GrabbingHand().transform);
     HandlePickup();
     lastPickupTime = Time.realtimeSinceStartup;
 }
Example #2
0
    void OnTriggerEnter(Collider other)
    {
        var snp = other.GetComponent <ObjectSnapArea>();

        if (snp != null &&
            snp.snapType == snapType &&
            snp.currSnappedObj == null &&
            transform.parent != null &&
            !transform.parent.GetComponent <ObjectSnapArea>() &&
            pickupSnapTimeout + lastPickupTime <= Time.realtimeSinceStartup)
        {
            SnapToObject(snp);
            Singletons.GrabbingHand().HandleSnapAway(this);
        }

        HandleTriggerEnter(other);
    }