// Update is called once per frame
 void Update()
 {
     if (Pointer.IsActive && Pointer.HoveredElement != null &&
         Vector3.Distance(Pointer.pointerEventData.pointerCurrentRaycast.worldPosition, Pointer.GetOriginPosition()) > 0.1f)
     {
         transform.position = Pointer.pointerEventData.pointerCurrentRaycast.worldPosition;
         transform.LookAt(Pointer.GetOriginPosition());
     }
 }
Beispiel #2
0
        /// <summary>
        /// Updates the pointer line
        /// </summary>
        void Update()
        {
            if (_pointer.IsActive)
            {
                Vector3 start = _pointer.GetOriginPosition();
                Vector3 end   = _pointer.HoveredElement != null ?
                                _pointer.pointerEventData.pointerCurrentRaycast.worldPosition :
                                start + _pointer.GetOriginForward() * 10;

                _line.SetPositions(new Vector3[]
                {
                    start,
                    end,
                });
            }
        }