/// <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(); }
/// <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); }