Beispiel #1
0
 /// <summary>
 /// Performs a raycast using eventData.worldSpaceRay
 /// </summary>
 /// <param name="eventData"></param>
 /// <param name="resultAppendList"></param>
 public override void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList)
 {
     if (eventData.IsVRPointer())
     {
         Raycast(eventData, resultAppendList, eventData.GetRay(), true):
     }
 }
Beispiel #2
0
    public void Raycast(AirXRPointer pointer, PointerEventData eventData, List <RaycastResult> resultAppendList)
    {
        if (eventData.IsVRPointer() == false)
        {
            base.Raycast(eventData, resultAppendList);
            return;
        }

        if (pointer.interactable)
        {
            raycast(eventData, resultAppendList, eventData.GetRay(), true);
        }
    }
 public override void Raycast(PointerEventData eventData, List <RaycastResult> resultAppendList)
 {
     if (eventData.IsVRPointer())
     {
         if (_pointer.interactable)
         {
             raycast(eventData, resultAppendList, eventData.GetRay(), true);
         }
     }
     else
     {
         base.Raycast(eventData, resultAppendList);
     }
 }
Beispiel #4
0
        /// <summary>
        /// Perform a raycast using the worldSpaceRay in eventData.
        /// </summary>
        /// <param name="eventData"></param>
        /// <param name="resultAppendList"></param>
        public override void Raycast(PointerEventData eventData, List <RaycastResult> resultAppendList)
        {
            // This function is closely based on PhysicsRaycaster.Raycast

            if (eventCamera == null)
            {
                return;
            }

            // if (!eventData.IsVRPointer())
            //     return;

            var ray = eventData.GetRay();

            float dist = eventCamera.farClipPlane - eventCamera.nearClipPlane;

            var hits = Physics.RaycastAll(ray, dist, finalEventMask);

            if (hits.Length > 1)
            {
                System.Array.Sort(hits, (r1, r2) => r1.distance.CompareTo(r2.distance));
            }

            if (hits.Length != 0)
            {
                for (int b = 0, bmax = hits.Length; b < bmax; ++b)
                {
                    var result = new RaycastResult
                    {
                        gameObject    = hits[b].collider.gameObject,
                        module        = this,
                        distance      = hits[b].distance,
                        index         = resultAppendList.Count,
                        worldPosition = hits[0].point,
                        worldNormal   = hits[0].normal,
                    };
                    resultAppendList.Add(result);
                }
            }
        }