Example #1
0
        private void Update()
        {
            var endPos = CalculateEndPoint();

            _previewObj.transform.position = endPos;
            position = endPos;
            if (_lineRenderer != null)
            {
                if (Math.Abs(_lineRenderer.startWidth - _rightHandLr.startWidth) > 0.001f)
                {
                    _lineRenderer.SetWidth(_rightHandLr.startWidth, _rightHandLr.endWidth);
                }
                _lineRenderer.SetPosition(0, endPos);
                _lineRenderer.SetPosition(1, VRUtils.GetControllerTransform().position);
            }
            SetupColors(Main.CanPlace());
            if (Input.GetKeyUp(KeyCode.Mouse0))
            {
                Main.RecreatePortal();
            }
        }
Example #2
0
        private Vector3 CalculateEndPoint()
        {
            var hit = XRDevice.isPresent ? VRUtils.RaycastVR() : Raycast();

            return(hit.collider ? hit.point : DefaultPos());
        }