//------------------------------------------------- private void OnAttachedToHand(Hand hand) { attached = true; onPickUp.Invoke(); hand.HoverLock(null); attachTime = Time.time; attachPosition = transform.position; attachRotation = transform.rotation; if (attachEaseIn) { attachEaseInTransform = hand.transform; if (!Util.IsNullOrEmpty(attachEaseInAttachmentNames)) { float smallestAngle = float.MaxValue; for (int i = 0; i < attachEaseInAttachmentNames.Length; i++) { Transform t = hand.GetAttachmentTransform(attachEaseInAttachmentNames[i]); float angle = Quaternion.Angle(t.rotation, attachRotation); if (angle < smallestAngle) { attachEaseInTransform = t; smallestAngle = angle; } } } } snapAttachEaseInCompleted = false; }
//------------------------------------------------- private Transform GetPointerStartTransform(Hand hand) { if (hand.noSteamVRFallbackCamera != null) { return(hand.noSteamVRFallbackCamera.transform); } return(pointerHand.GetAttachmentTransform("Attach_ControllerTip")); }
//------------------------------------------------- private void OnAttachedToHand(Hand hand) { attached = true; if (keyObjectScript != null) { keyObjectScript.currentHand = hand; keyObjectScript.SetHeld(hand); } onPickUp.Invoke(); hand.HoverLock(null); Rigidbody rb = GetComponent <Rigidbody>(); rb.isKinematic = true; rb.interpolation = RigidbodyInterpolation.None; if (hand.controller == null) { velocityEstimator.BeginEstimatingVelocity(); } attachTime = Time.time; attachPosition = transform.position; attachRotation = transform.rotation; if (attachEaseIn) { attachEaseInTransform = hand.transform; if (!Util.IsNullOrEmpty(attachEaseInAttachmentNames)) { float smallestAngle = float.MaxValue; for (int i = 0; i < attachEaseInAttachmentNames.Length; i++) { Transform t = hand.GetAttachmentTransform(attachEaseInAttachmentNames[i]); float angle = Quaternion.Angle(t.rotation, attachRotation); if (angle < smallestAngle) { attachEaseInTransform = t; smallestAngle = angle; } } } } snapAttachEaseInCompleted = false; }
private void OnAttachedToHand(Hand hand) { this.attached = true; this.onPickUp.Invoke(); hand.HoverLock(null); Rigidbody component = base.GetComponent <Rigidbody>(); component.isKinematic = true; component.interpolation = RigidbodyInterpolation.None; if (hand.controller == null) { this.velocityEstimator.BeginEstimatingVelocity(); } this.attachTime = Time.time; this.attachPosition = base.transform.position; this.attachRotation = base.transform.rotation; if (this.attachEaseIn) { this.attachEaseInTransform = hand.transform; if (!Util.IsNullOrEmpty <string>(this.attachEaseInAttachmentNames)) { float num = float.MaxValue; for (int i = 0; i < this.attachEaseInAttachmentNames.Length; i++) { Transform attachmentTransform = hand.GetAttachmentTransform(this.attachEaseInAttachmentNames[i]); float num2 = Quaternion.Angle(attachmentTransform.rotation, this.attachRotation); if (num2 < num) { this.attachEaseInTransform = attachmentTransform; num = num2; } } } } this.snapAttachEaseInCompleted = false; }
//------------------------------------------------- private void OnAttachedToHand(Hand hand) { attached = true; onPickUp.Invoke(); hand.HoverLock(null); ///////////////////////////////////////////////////// if (GetComponent <ActivateText>()) { GetComponent <ActivateText>().ShowText(); } if (GetComponent <Key>()) { GetComponent <Key>().KeyGrabbed(); return; } if (GetComponent <RequiredClue>()) { GetComponent <RequiredClue>().ObjectPickedUp(); } if (GetComponent <DestroyWhenPickedUp>()) { GetComponent <DestroyWhenPickedUp>().DestroyItem(); } if (GetComponent <ReturnToPositionAfterPickup>()) { GetComponent <ReturnToPositionAfterPickup>().StopReturning(); } ///////////////////////////////////////////////////// Rigidbody rb = GetComponent <Rigidbody>(); rb.isKinematic = true; rb.interpolation = RigidbodyInterpolation.None; if (hand.controller == null) { velocityEstimator.BeginEstimatingVelocity(); } attachTime = Time.time; attachPosition = transform.position; attachRotation = transform.rotation; if (attachEaseIn) { attachEaseInTransform = hand.transform; if (!Util.IsNullOrEmpty(attachEaseInAttachmentNames)) { float smallestAngle = float.MaxValue; for (int i = 0; i < attachEaseInAttachmentNames.Length; i++) { Transform t = hand.GetAttachmentTransform(attachEaseInAttachmentNames[i]); float angle = Quaternion.Angle(t.rotation, attachRotation); if (angle < smallestAngle) { attachEaseInTransform = t; smallestAngle = angle; } } } } snapAttachEaseInCompleted = false; }