private void HidePointer()
    {
        //if (visible)
        //{
        //pointerHideStartTime = Time.time;
        //}
        visible = false;

        teleportArc.Hide();
        invalidReticleTransform.gameObject.SetActive(false);
    }
Example #2
0
    private void GrabReleased()
    {
        if (controllerPointer.outline != null)
        {
            Destroy(controllerPointer.outline);
        }

        if (grabObject != null)
        {
            grabObject = null;
            teleportArc.Hide();
        }
    }
    private void UpdateArc()
    {
        if (SteamVR_Actions.default_TouchPad[SteamVR_Input_Sources.RightHand].axis == Vector2.zero)
        {
            if (IsArcActive)
            {
                _arc.Hide();
                _teleportMarker.SetAlpha(0f, 0f);
            }
            IsArcActive = false;
            return;
        }

        IsArcActive = true;
        Vector3 arcVelocity = _aimAnchor.forward * _maxDistance;

        _arc.SetArcData(_aimAnchor.position, arcVelocity, true, false);

        bool didHit = _arc.DrawArc(out RaycastHit hit);

        if (didHit)
        {
            _arcTarget        = hit.point;
            _isArcTargetValid = true;
            _arc.SetColor(Color.green);

            _teleportMarker.transform.position = hit.point;
            _log.Append("origTarget", hit.point);

            Vector3 markerPos;
            if (_markerCollider.HasCollided())
            {
                markerPos   = _markerCollider.GetAdjustedPosition();
                markerPos.y = hit.point.y;
                _teleportMarker.transform.position = markerPos;

                _log.Append("shiftedTarget", markerPos);
            }

            _teleportMarker.SetAlpha(1f, 1f);
        }

        if (!didHit || hit.collider.gameObject.layer != 12)
        {
            _arc.SetColor(Color.red);
            _teleportMarker.SetAlpha(0f, 0f);
            _isArcTargetValid = false;
        }
        _arc.Show();
        _log.Append("targetValid", _isArcTargetValid);
    }
Example #4
0
    //-------------------------------------------------
    private void HidePointer()
    {
        if (visible)
        {
            pointerHideStartTime = Time.time;
        }

        visible = false;
        if (pointerHand)
        {
            //NVRReplace
            Debug.LogWarning("Skiiping ShouldOverrideHoverLock() method");

            /*
             * if ( ShouldOverrideHoverLock() )
             * {
             *      //Restore the original hovering interactable on the hand
             *      if ( originalHoverLockState == true )
             *      {
             *              pointerHand.HoverLock( originalHoveringInteractable );
             *      }
             *      else
             *      {
             *              pointerHand.HoverUnlock( null );
             *      }
             * }
             */

            //Stop looping sound
            loopingAudioSource.Stop();
            PlayAudioClip(pointerAudioSource, pointerStopSound);
        }
        teleportPointerObject.SetActive(false);

        teleportArc.Hide();

        foreach (TeleportMarkerBase teleportMarker in teleportMarkers)
        {
            if (teleportMarker != null && teleportMarker.markerActive && teleportMarker.gameObject != null)
            {
                teleportMarker.gameObject.SetActive(false);
            }
        }

        destinationReticleTransform.gameObject.SetActive(false);
        invalidReticleTransform.gameObject.SetActive(false);
        offsetReticleTransform.gameObject.SetActive(false);

        if (playAreaPreviewTransform != null)
        {
            playAreaPreviewTransform.gameObject.SetActive(false);
        }

        if (onActivateObjectTransform.gameObject.activeSelf)
        {
            onActivateObjectTransform.gameObject.SetActive(false);
        }
        onDeactivateObjectTransform.gameObject.SetActive(true);

        pointerHand = null;
    }