Beispiel #1
0
 /// <summary>
 /// If this object has been moved and then released without triggering the transition, it is reset to its inital position.
 /// </summary>
 private void Update()
 {
     if (this.transform.localPosition != defaultPos && !grab.IsInteracting())
     {
         ResetTransform();
     }
 }
Beispiel #2
0
        protected void CheckReset(Collider other)
        {
            SenseGlove_Grabable grabable = other.gameObject.GetComponent <SenseGlove_Grabable>();

            if (other.tag.Contains(this.resetTag) && grabable != null && !grabable.IsInteracting())
            {
                grabable.ResetObject();
                //Debug.Log("Reset " + other.name);
            }
        }
    /// <summary> Adds an object to this SenseGlove_DropZone. Does not fire the eventTime. </summary>
    /// <param name="grabable"></param>
    public virtual void AddObject(SenseGlove_Grabable grabable)
    {
        this.objectsInside.Add(grabable);
        this.dropProperties.Add(new DropProps());

        if (this.detectionTime == 0 && (!grabable.IsInteracting() || this.detectHeldObjects))
        {
            this.dropProperties[this.dropProperties.Count - 1].detected = true; //mark that we have detected it!
            this.CallObjectDetect(grabable);
        }
    }
 /// <summary> Restore properties back to their original state(s). </summary>
 /// <param name="grabable"></param>
 public void RestoreProperties(SenseGlove_Grabable grabable)
 {
     if (!grabable.IsInteracting())
     {
         grabable.SetInteractable(this.wasInteractable);
         grabable.pickupReference.transform.parent = this.oldParent;
         if (grabable.physicsBody != null)
         {
             grabable.physicsBody.useGravity  = this.usedGravity;
             grabable.physicsBody.isKinematic = this.wasKinematic;
         }
     }
     this.BreakJoint();
 }
    /// <summary> Called when an Object is detected and its event is called. End interation if needed, then snap it </summary>
    /// <param name="detectedObject"></param>
    protected override void CallObjectDetect(SenseGlove_Grabable detectedObject)
    {
        if (this.disablesInteraction)
        {
            detectedObject.SetInteractable(false);
        }

        if (this.takesFromHand)
        {
            detectedObject.EndInteraction();
        }

        if (!detectedObject.IsInteracting())
        {
            this.AttachObject(detectedObject);
        }
        else //we still are interacting, meaning we did not disable nor take from the hand.
        {
            detectedObject.InteractionEnded += Grabable_InteractionEnded; //not subscribed to untill this object is released.
        }
        base.CallObjectDetect(detectedObject);
    }