//------------------------------------------------- private bool PhysicsDetach(Hand hand) { int i = holdingHands.IndexOf(hand); if (i != -1) { // Detach this object from the hand holdingHands[i].DetachObject(this.gameObject, false); // Allow the hand to do other things holdingHands[i].HoverUnlock(null); // Delete any existing joints from the hand if (attachMode == AttachMode.FixedJoint) { Destroy(holdingHands[i].GetComponent <FixedJoint>()); } Util.FastRemove(holdingHands, i); Util.FastRemove(holdingBodies, i); Util.FastRemove(holdingPoints, i); return(true); } return(false); }
private bool PhysicsDetach(Hand hand) { int num = this.holdingHands.IndexOf(hand); if (num != -1) { this.holdingHands[num].DetachObject(base.gameObject, false); this.holdingHands[num].HoverUnlock(null); if (this.attachMode == ComplexThrowable.AttachMode.FixedJoint) { UnityEngine.Object.Destroy(this.holdingHands[num].GetComponent <FixedJoint>()); } Util.FastRemove <Hand>(this.holdingHands, num); Util.FastRemove <Rigidbody>(this.holdingBodies, num); Util.FastRemove <Vector3>(this.holdingPoints, num); return(true); } return(false); }
//------------------------------------------------- private bool PhysicsDetach(Hand hand) { int i = holdingHands.IndexOf(hand); if (i != -1) { Vector3 vel = Vector3.zero; if (holdingHands.Count <= 1) { vel = hand.GetTrackedObjectVelocity(); } // Detach this object from the hand holdingHands[i].DetachObject(this.gameObject, false); // Allow the hand to do other things holdingHands[i].HoverUnlock(null); // Delete any existing joints from the hand if (attachMode == AttachMode.FixedJoint) { Destroy(holdingHands[i].GetComponent <FixedJoint>()); } Util.FastRemove(holdingHands, i); Util.FastRemove(holdingBodies, i); Util.FastRemove(holdingPoints, i); GetComponent <Rigidbody>().isKinematic = false; GetComponent <Rigidbody>().AddForce(vel * VelocityMult); return(true); } return(false); }