public virtual void OnCollisionExit(Collision collision) { Rigidbody objRigidbody = collision.rigidbody; if (objRigidbody != null) { HandInteraction.OnTouchEnd(handTarget, objRigidbody.gameObject); } else { HandInteraction.OnTouchEnd(handTarget, collision.gameObject); } }
public virtual void OnTriggerExit(Collider collider) { Rigidbody objRigidbody = collider.attachedRigidbody; if (objRigidbody != null) { HandInteraction.OnTouchEnd(handTarget, objRigidbody.gameObject); } else { HandInteraction.OnTouchEnd(handTarget, collider.gameObject); } handTarget.touchedObject = null; }
public override void ManualFixedUpdate(HandTarget _handTarget) { handTarget = _handTarget; if (hasCollided && !colliding) { HandInteraction.OnTouchEnd(handTarget, handTarget.touchedObject); handTarget.touchedObject = null; } if (handTarget.touchedObject == null) // Object may be destroyed { hasCollided = false; } if (handRigidbody == null) { Initialize(); } // Check for stuck hands. Only when hand is kinematic you can pull the hand loose // it will then turn into a kinematic hand, which results in snapping the hand back // onto the forearm. if (handTarget.forearm.bone.transform != null && !handRigidbody.isKinematic) { float distance = Vector3.Distance(handTarget.hand.bone.transform.position, handTarget.forearm.bone.transform.position) - handTarget.forearm.bone.length; if (distance > 0.05F) { //SetKinematic(handRigidbody, true); handTarget.colliders = SetKinematic(handRigidbody); } } UpdateRigidbody(); colliding = false; }