Exemple #1
0
 public bool drop(Vector3 position)
 {
     if (!isHandFree())
     {
         objInHand.parent   = null;
         objInHand.position = new Vector3(position.x, objInHand.position.y, position.z);
         Rigidbody auxRigidbody = objInHand.GetComponent <Rigidbody>();
         if (auxRigidbody != null)
         {
             auxRigidbody.isKinematic = false;
         }
         TouchProperties tP = objInHand.GetComponent <TouchProperties>();
         if (tP != null)
         {
             tP.exertPressure(false);
         }
         objInHand = null;
         return(true);
     }
     return(false);
 }
Exemple #2
0
    public bool hold(Transform obj)
    {
        if (isHandFree())
        {
            obj.parent = hand;
            Rigidbody auxRigidbody = obj.GetComponent <Rigidbody>();
            if (auxRigidbody != null)
            {
                auxRigidbody.isKinematic = true;
            }
            obj.position = refPosGrabObj.position;//new Vector3(refPosGrabObj.position.x,obj.position.y, refPosGrabObj.position.z);
            TouchProperties tP = obj.GetComponent <TouchProperties>();
            if (tP != null)
            {
                tP.exertPressure(true);
            }
            objInHand = obj;

            return(true);
        }
        return(false);
    }