コード例 #1
0
ファイル: InputModule.cs プロジェクト: matthewcpp/VrBlocks
        public void AddPointer(Pointer pointer)
        {
            if (pointerCache.ContainsKey(pointer))
            {
                return;
            }

            var pointerEventData = new RaycastPointerEventDara(eventSystem);

            pointerCache[pointer] = pointerEventData;
        }
コード例 #2
0
ファイル: InputModule.cs プロジェクト: matthewcpp/VrBlocks
        public override void Process()
        {
            foreach (var item in pointerCache)
            {
                Pointer pointer = item.Key;
                RaycastPointerEventDara pointerEventData = item.Value;

                List <RaycastResult> results = GetRaycastResults(pointer, pointerEventData);

                Process(pointer, pointerEventData, results);
            }
        }
コード例 #3
0
ファイル: Raycaster.cs プロジェクト: matthewcpp/VrBlocks
        public override void Raycast(PointerEventData eventData, List <RaycastResult> resultAppendList)
        {
            if (canvas == null || eventCamera == null)
            {
                return;
            }

            RaycastPointerEventDara myPointerEventData = eventData as RaycastPointerEventDara;

            Raycast(canvas, eventCamera, eventData, myPointerEventData.SelectionRay, ref s_RaycastResults);
            SetNearestRaycast(ref eventData, ref resultAppendList, ref s_RaycastResults);
            s_RaycastResults.Clear();
        }
コード例 #4
0
ファイル: InputModule.cs プロジェクト: matthewcpp/VrBlocks
        protected virtual List <RaycastResult> GetRaycastResults(Pointer pointer, RaycastPointerEventDara pointerEventData)
        {
            List <RaycastResult> raycasts = new List <RaycastResult>();

            if (pointer.Active)
            {
                Ray ray = pointer.SelectionRay;
                pointerEventData.SelectionRay = ray;

                RaycastResult raycastResult = new RaycastResult();
                raycastResult.worldPosition            = ray.origin;
                raycastResult.worldNormal              = ray.direction;
                pointerEventData.pointerCurrentRaycast = raycastResult;

                eventSystem.RaycastAll(pointerEventData, raycasts);
            }

            return(raycasts);
        }