Exemplo n.º 1
0
        /// <summary> Adds an object to this SenseGlove_DropZone. Does not fire the eventTime. </summary>
        /// <param name="grabable"></param>
        public virtual void AddObject(SG_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);
            }
        }
Exemplo n.º 2
0
 /// <summary> Restore properties back to their original state(s). </summary>
 /// <param name="grabable"></param>
 public void RestoreProperties(SG_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();
 }
Exemplo n.º 3
0
        /// <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(SG_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);
        }