//------------------------------------------------- private void OnDetachedFromHand(Hand hand) { lastHeld = Time.time; if (onDetachedFromHand != null) { onDetachedFromHand.Invoke(hand); } Vector3 aux = Player.instance.trackingOriginTransform.TransformVector(hand.controller.velocity); Debug.Log("WE ARE DETACHED FROM LIFE AND LOVE!"); if (hand.GetInstanceID() == Hand1.GetInstanceID()) { script.startPoint = Hand1.transform.position; script.endPoint = Hand2.transform.position; script.heightVector = aux; if (2.0f * aux.y > Mathf.Sqrt(aux.x * aux.x + aux.z * aux.z) && aux.y > 0.03f) { script.followTrajectory = true; } else { script.followTrajectory = false; } } if (hand.GetInstanceID() == Hand2.GetInstanceID()) { script.startPoint = Hand2.transform.position; script.endPoint = Hand1.transform.position; script.heightVector = aux; if (2.0f * aux.y > Mathf.Sqrt(aux.x * aux.x + aux.z * aux.z) && aux.y > 0.03f) { script.followTrajectory = true; } else { script.followTrajectory = false; } } script.count = 0.0f; if (hand.GuessCurrentHandType() == Hand.HandType.Right) { } if (hand.GuessCurrentHandType() == Hand.HandType.Left) { } }
protected virtual void OnEnable() { inputFocusAction.enabled = true; // Stagger updates between hands float hoverUpdateBegin = ((otherHand != null) && (otherHand.GetInstanceID() < GetInstanceID())) ? (0.5f * hoverUpdateInterval) : (0.0f); InvokeRepeating("UpdateHovering", hoverUpdateBegin, hoverUpdateInterval); }
//------------------------------------------------- private void OnEnable() { inputFocusAction.enabled = true; // Stagger updates between hands var hoverUpdateBegin = ((otherHand != null) && (otherHand.GetInstanceID() < GetInstanceID())) ? (0.5f * hoverUpdateInterval) : (0.0f); InvokeRepeating("UpdateHovering", hoverUpdateBegin, hoverUpdateInterval); InvokeRepeating("UpdateDebugText", hoverUpdateBegin, hoverUpdateInterval); }