예제 #1
0
        void OnEnable()
        {
            m_LineRenderer = GetComponent <XRLineRenderer>();
            m_DefaultWidth = m_LineRenderer.widthMultiplier;
            var mainCamera = Camera.main;

            if (mainCamera != null)
            {
                m_CameraTransform = mainCamera.transform;
            }
        }
예제 #2
0
        private void SetPositions(XRLineRenderer line, Vector3 originPoint, Vector3 anchorPoint)
        {
            Vector3 transformedOrigin = transform.InverseTransformPoint(originPoint);
            Vector3 transformedAnchor = transform.InverseTransformPoint(anchorPoint);

            Vector3[] points = new Vector3[_numberOfPoints];
            for (int i = 0; i < _numberOfPoints; i++)
            {
                points[i] = Vector3.Lerp(transformedOrigin, transformedAnchor, i / (float)(_numberOfPoints - 1));
            }
            line.SetPositions(points);
        }
예제 #3
0
        public void Init(MAIAHologramDiagram[] diagrams)
        {
            _diagrams = diagrams;
            int size = _diagrams.Length;

            _lines             = new XRLineRenderer[size];
            _previousPositions = new Vector3[size];
            for (int i = 0; i < size; i++)
            {
                XRLineRenderer line = Instantiate(_lineRendererPrefab, transform);
                line.transform.localPosition = Vector3.zero;
                line.transform.localRotation = Quaternion.identity;
                SetPositions(line, _originPoint.position, _diagrams[i].anchorPoint.position);
                _lines[i]             = line;
                _previousPositions[i] = _diagrams[i].anchorPoint.position;
            }
        }
예제 #4
0
        void Awake()
        {
            m_SphereScale     = m_MotionIndicatorSphere.transform.localScale;
            m_VisualsMaterial = MaterialUtils.GetMaterialClone(m_MotionIndicatorSphere.GetComponent <Renderer>());

            m_Positions = new Vector3[m_MaxProjectileSteps];

            m_LineRenderer = GetComponent <XRLineRenderer>();
            m_LineRenderer.SetPositions(m_Positions, true);

            m_Spheres = new Transform[m_SphereCount];
            for (var i = 0; i < m_SphereCount; i++)
            {
                m_Spheres[i] = Instantiate(m_MotionIndicatorSphere, transform, false).transform;
            }

            foreach (var renderer in m_ArcLocator.GetComponentsInChildren <Renderer>(true))
            {
                renderer.sharedMaterial = m_VisualsMaterial;
            }
        }
예제 #5
0
 private void Reset()
 {
     _lineRenderer = GetComponent <XRLineRenderer>();
 }
예제 #6
0
 private void Reset()
 {
     _lineRenderer = GetComponentInChildren <XRLineRenderer>();
 }