//------------------------------------------------- private void HandAttachedUpdate(Hand hand) { //Trigger got released if (!hand.GetStandardInteractionButton()) { // Detach ourselves late in the frame. // This is so that any vehicles the player is attached to // have a chance to finish updating themselves. // If we detach now, our position could be behind what it // will be at the end of the frame, and the object may appear // to teleport behind the hand when the player releases it. StartCoroutine(LateDetach(hand)); } if (attachEaseIn) { float t = Util.RemapNumberClamped(Time.time, attachTime, attachTime + snapAttachEaseInTime, 0.0f, 1.0f); if (t < 1.0f) { t = snapAttachEaseInCurve.Evaluate(t); transform.position = Vector3.Lerp(attachPosition, attachEaseInTransform.position, t); transform.rotation = Quaternion.Lerp(attachRotation, attachEaseInTransform.rotation, t); } else if (!snapAttachEaseInCompleted) { gameObject.SendMessage("OnThrowableAttachEaseInCompleted", hand, SendMessageOptions.DontRequireReceiver); snapAttachEaseInCompleted = true; } } }
// Token: 0x06002033 RID: 8243 RVA: 0x0009EBBC File Offset: 0x0009CDBC private void HandHoverUpdate(Hand hand) { if (hand.GetStandardInteractionButtonDown()) { this.lastHandProjected = this.ComputeToTransformProjected(hand.hoverSphereTransform); if (this.hoverLock) { hand.HoverLock(base.GetComponent <Interactable>()); this.handHoverLocked = hand; } this.driving = true; this.ComputeAngle(hand); this.UpdateAll(); ControllerButtonHints.HideButtonHint(hand, new EVRButtonId[] { EVRButtonId.k_EButton_Axis1 }); return; } if (hand.GetStandardInteractionButtonUp()) { if (this.hoverLock) { hand.HoverUnlock(base.GetComponent <Interactable>()); this.handHoverLocked = null; return; } } else if (this.driving && hand.GetStandardInteractionButton() && hand.hoveringInteractable == base.GetComponent <Interactable>()) { this.ComputeAngle(hand); this.UpdateAll(); } }
//------------------------------------------------- private void OnHandHoverBegin(Hand hand) { bool showHint = false; // "Catch" the throwable by holding down the interaction button instead of pressing it. // Only do this if the throwable is moving faster than the prescribed threshold speed, // and if it isn't attached to another hand if (!attached) { if (hand.GetStandardInteractionButton()) { Rigidbody rb = GetComponent <Rigidbody>(); if (rb.velocity.magnitude >= catchSpeedThreshold) { hand.AttachObject(gameObject, attachmentFlags, attachmentPoint); showHint = false; } } } if (showHint) { ControllerButtonHints.ShowButtonHint(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger); } }
//------------------------------------------------- private void HandHoverUpdate(Hand hand) { if (hand.GetStandardInteractionButtonDown()) { // Trigger was just pressed lastHandProjected = ComputeToTransformProjected(hand.hoverSphereTransform); if (hoverLock) { hand.HoverLock(GetComponent <Interactable>()); handHoverLocked = hand; } driving = true; ComputeAngle(hand); UpdateAll(); ControllerButtonHints.HideButtonHint(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger); } else if (hand.GetStandardInteractionButtonUp()) { // Trigger was just released if (hoverLock) { hand.HoverUnlock(GetComponent <Interactable>()); handHoverLocked = null; } } else if (driving && hand.GetStandardInteractionButton() && hand.hoveringInteractable == GetComponent <Interactable>()) { ComputeAngle(hand); UpdateAll(); } }
//------------------------------------------------- private void Pulse() { if (hand && (hand.controller != null) && (hand.GetStandardInteractionButton())) { ushort duration = (ushort)Random.Range(minimumPulseDuration, maximumPulseDuration + 1); hand.controller.TriggerHapticPulse(duration); onPulse.Invoke(); } }
//------------------------------------------------- private void OnHandHoverEnd(Hand hand) { ControllerButtonHints.HideButtonHint(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger); if (driving && hand.GetStandardInteractionButton()) { StartCoroutine(HapticPulses(hand.controller, 1.0f, 10)); } driving = false; handHoverLocked = null; }
private void OnHandHoverEnd(Hand hand) { ControllerButtonHints.HideButtonHint(hand, new EVRButtonId[] { EVRButtonId.k_EButton_Axis1 }); if (this.driving && hand.GetStandardInteractionButton()) { base.StartCoroutine(this.HapticPulses(hand.controller, 1f, 10)); } this.driving = false; this.handHoverLocked = null; }
// Update is called once per frame void Update() { if (hand.GetStandardInteractionButton()) { transform.localScale *= 1.05f; transform.localScale = Mathf.Min(transform.localScale, max); } else { transform.localScale *= 0.9f; transform.localScale = Mathf.Max(transform.localScale, min); } }
private void OnHandHoverBegin(Hand hand) { if (!attached) { if (hand.GetStandardInteractionButton()) { Rigidbody rb = GetComponent <Rigidbody>(); if (rb.velocity.magnitude >= catchSpeedThreshold) { hand.AttachObject(gameObject, attachmentFlags, attachmentPoint); } } } }
//------------------------------------------------- // Called every Update() while this GameObject is attached to the hand //------------------------------------------------- private void HandAttachedUpdate(Hand hand) { //Trigger got released if (!hand.GetStandardInteractionButton()) { // Detach ourselves late in the frame. // This is so that any vehicles the player is attached to // have a chance to finish updating themselves. // If we detach now, our position could be behind what it // will be at the end of the frame, and the object may appear // to teleport behind the hand when the player releases it. StartCoroutine(LateDetach(hand)); } }
// Token: 0x06002110 RID: 8464 RVA: 0x000A3118 File Offset: 0x000A1318 private void OnHandHoverBegin(Hand hand) { bool flag = false; if (!this.attached && hand.GetStandardInteractionButton() && base.GetComponent <Rigidbody>().velocity.magnitude >= this.catchSpeedThreshold) { hand.AttachObject(base.gameObject, this.attachmentFlags, this.attachmentPoint); flag = false; } if (flag) { ControllerButtonHints.ShowButtonHint(hand, new EVRButtonId[] { EVRButtonId.k_EButton_Axis1 }); } }
// Token: 0x06005CDE RID: 23774 RVA: 0x00206C54 File Offset: 0x00205054 private void HandHoverUpdate(Hand hand) { if (hand.GetStandardInteractionButtonDown()) { hand.HoverLock(base.GetComponent <Interactable>()); this.initialMappingOffset = this.linearMapping.value - this.CalculateLinearMapping(hand.transform); this.sampleCount = 0; this.mappingChangeRate = 0f; } if (hand.GetStandardInteractionButtonUp()) { hand.HoverUnlock(base.GetComponent <Interactable>()); this.CalculateMappingChangeRate(); } if (hand.GetStandardInteractionButton()) { this.UpdateLinearMapping(hand.transform); } }
private void OnHandHoverBegin(Hand hand) { if (canBeHit) { if (hand.GetStandardInteractionButton() && hand.GetTrackedObjectVelocity().magnitude >= hitVelocity) { if (hand.currentAttachedObject == null) { Debug.Log("monster got hit"); Boxing mBoxing = GetComponent <Boxing>(); if (mBoxing) { mBoxing.GetHit(false); StartCoroutine("HitRefresh"); } } } } }
private void HandAttachedUpdate(Hand hand) { if (!hand.GetStandardInteractionButton()) { base.StartCoroutine(this.LateDetach(hand)); } if (this.attachEaseIn) { float num = Util.RemapNumberClamped(Time.time, this.attachTime, this.attachTime + this.snapAttachEaseInTime, 0f, 1f); if (num < 1f) { num = this.snapAttachEaseInCurve.Evaluate(num); base.transform.position = Vector3.Lerp(this.attachPosition, this.attachEaseInTransform.position, num); base.transform.rotation = Quaternion.Lerp(this.attachRotation, this.attachEaseInTransform.rotation, num); } else if (!this.snapAttachEaseInCompleted) { base.gameObject.SendMessage("OnThrowableAttachEaseInCompleted", hand, SendMessageOptions.DontRequireReceiver); this.snapAttachEaseInCompleted = true; } } }
//------------------------------------------------- private void HandAttachedUpdate(Hand hand) { if (!hand.GetStandardInteractionButton()) { StartCoroutine(LateDetach(hand)); } if (attachEaseIn) { float t = Util.RemapNumberClamped(Time.time, attachTime, attachTime + snapAttachEaseInTime, 0.0f, 1.0f); if (t < 1.0f) { t = snapAttachEaseInCurve.Evaluate(t); transform.position = Vector3.Lerp(attachPosition, attachEaseInTransform.position, t); transform.rotation = Quaternion.Lerp(attachRotation, attachEaseInTransform.rotation, t); } else if (!snapAttachEaseInCompleted) { gameObject.SendMessage("OnThrowableAttachEaseInCompleted", hand, SendMessageOptions.DontRequireReceiver); snapAttachEaseInCompleted = true; } } }
//------------------------------------------------- private void HandHoverUpdate(Hand hand) { if (hand.GetStandardInteractionButtonDown()) { hand.HoverLock(GetComponent <Interactable>()); initialMappingOffset = linearMapping.value - CalculateLinearMapping(hand.transform); sampleCount = 0; mappingChangeRate = 0.0f; } if (hand.GetStandardInteractionButtonUp()) { hand.HoverUnlock(GetComponent <Interactable>()); CalculateMappingChangeRate(); } if (hand.GetStandardInteractionButton()) { UpdateLinearMapping(hand.transform); } }
void FixedUpdate() { //SteamVR_Controller.Device device = SteamVR_Controller.Input((int)rightController.index); //SteamVR_Controller.Device device = rightController.controller; //if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger)) { if (rightController.GetStandardInteractionButtonDown()) { dragging = false; Ray ray = new Ray(rightController.transform.position, rightController.transform.forward); RaycastHit hit; if (myCollider.Raycast(ray, out hit, 100)) { dragging = true; } } //if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Trigger)) dragging = false; if (rightController.GetStandardInteractionButtonUp()) { dragging = false; } if (rightController.GetStandardInteractionButton()) { // if (dragging && device.GetTouch(SteamVR_Controller.ButtonMask.Trigger)) { Ray ray = new Ray(rightController.transform.position, rightController.transform.forward); RaycastHit hit; if (myCollider.Raycast(ray, out hit, 100)) { var point = hit.point; //Camera.main.ScreenToWorldPoint(Input.mousePosition); //point = myCollider.ClosestPointOnBounds(point); SetThumbPosition(point); BoxCollider boxCollider = GetComponent <BoxCollider>(); SendMessage("OnDrag", Vector3.one - (thumb.localPosition - minBound.localPosition) / boxCollider.size.x); } } }
// ---------- ---------- ---------- ---------- ---------- public bool CheckLongInput() { //m_hand.controller.TriggerHapticPulse(); return(m_hand.GetStandardInteractionButton()); }
void Update() { m_animator.SetBool("Pointing", m_parentHand.GetStandardInteractionButton()); }