/// <summary> Called when a SenseGlove_Grabscript no longer wishes to interact with this grabable. </summary> /// <param name="grabScript"></param> /// <param name="fromExternal"></param> public override void EndInteraction(SenseGlove_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. 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.OnReleased(); this._grabScript = null; this.grabReference = null; } }
/// <summary> Called when a SenseGlove_Grabscript no longer wishes to interact with this grabable. </summary> /// <param name="grabScript"></param> /// <param name="fromExternal"></param> protected override bool InteractionEnd(SenseGlove_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) { if (pickupReference.transform.parent.name == "Molekül") { this.pickupReference.parent.parent = null; } else if (pickupReference.transform.parent.name == "editTeil") { this.pickupReference.parent.parent = GameObject.Find("Molekül").transform; while (GameObject.Find("editTeil").transform.childCount > 0) { GameObject.Find("editTeil").transform.GetChild(GameObject.Find("editTeil").transform.childCount - 1).parent = GameObject.Find("Molekül").transform; } } else { 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); }