/// <summary> Called when a SG_GrabScript no longer wishes to interact with this grabable. </summary> /// <param name="grabScript"></param> /// <param name="fromExternal"></param> protected override bool InteractionEnd(SG_GrabScript grabScript, bool fromExternal = false) { //SenseGlove_Debugger.Log("End Interaction, fromExternal = " + fromExternal); if (this.InteractingWith(grabScript) || fromExternal) { if (this.IsInteracting()) { //break every possible instance that could connect this interactable to the grabscript. if (this.pickupReference != null) { this.pickupReference.parent = this.originalParent; } this.BreakJoint(); if (this.physicsBody != null) { this.physicsBody.useGravity = this.usedGravity; this.physicsBody.isKinematic = this.wasKinematic; if (grabScript != null) { this.physicsBody.velocity = grabScript.GetVelocity(); this.physicsBody.angularVelocity = grabScript.GetAngularVelocity(); } } } this._grabScript = null; this.grabReference = null; return(true); } return(false); }
/// <summary> Ends the interaction between the grabscript and this hinge </summary> /// <param name="grabScript"></param> protected override bool InteractionEnd(SG_GrabScript grabScript, bool fromExternal = false) { if (this.IsInteracting()) { //break every possible instance that could connect this interactable to the grabscript. if (this.physicsBody != null) { //SenseGlove_Debugger.Log("Re-Applied kinematics"); this.physicsBody.useGravity = this.usedGravity; this.physicsBody.isKinematic = this.wasKinematic; this.StopPhysicsBody(); if (grabScript != null) { this.physicsBody.velocity = grabScript.GetVelocity(); } } } this._grabScript = null; this.grabReference = null; return(true); }