private void UpdateReticle(GameObject preGazedObject, PointerEventData pointerEvent)
    {
        if (gazePointer == null)
        {
            return;
        }

        GameObject curGazeObject        = GetCurrentGameObject(pointerEvent);
        Vector3    intersectionPosition = GetIntersectionPosition(pointerEvent);

        WaveVR_RaycastResultProvider.Instance.SetRaycastResult(
            WaveVR_Controller.EDeviceType.Head,
            curGazeObject,
            intersectionPosition);

        bool isInteractive = pointerEvent.pointerPress != null || ExecuteEvents.GetEventHandler <IPointerClickHandler>(curGazeObject) != null;

        if (curGazeObject == preGazedObject)
        {
            if (curGazeObject != null)
            {
                gazePointer.OnGazeStay(pointerEvent.enterEventCamera, curGazeObject, intersectionPosition, isInteractive);
            }
            else
            {
                gazePointer.OnGazeExit(pointerEvent.enterEventCamera, preGazedObject);
                return;
            }
        }
        else
        {
            if (preGazedObject != null)
            {
                gazePointer.OnGazeExit(pointerEvent.enterEventCamera, preGazedObject);
            }
            if (curGazeObject != null)
            {
                gazePointer.OnGazeEnter(pointerEvent.enterEventCamera, curGazeObject, intersectionPosition, isInteractive);
            }
        }
        UpdateProgressDistance(pointerEvent);
    }
Exemplo n.º 2
0
    private void UpdateReticle(GameObject preGazedObject, PointerEventData pointerEvent)
    {
        WaveVR_Reticle gazePointer = Object.FindObjectOfType <WaveVR_Reticle>();

        if (gazePointer == null)
        {
            return;
        }

        GameObject curGazeObject        = GetCurrentGameObject(pointerEvent);
        Vector3    intersectionPosition = GetIntersectionPosition(pointerEvent);
        //Ray reticle_ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        bool isInteractive = pointerEvent.pointerPress != null || ExecuteEvents.GetEventHandler <IPointerClickHandler>(curGazeObject) != null;

        if (curGazeObject == preGazedObject)
        {
            if (curGazeObject != null)
            {
                gazePointer.OnGazeStay(pointerEvent.enterEventCamera, curGazeObject, intersectionPosition, isInteractive);
            }
            else
            {
                gazePointer.OnGazeExit(pointerEvent.enterEventCamera, preGazedObject);
                return;
            }
        }
        else
        {
            if (preGazedObject != null)
            {
                gazePointer.OnGazeExit(pointerEvent.enterEventCamera, preGazedObject);
            }
            if (curGazeObject != null)
            {
                gazePointer.OnGazeEnter(pointerEvent.enterEventCamera, curGazeObject, intersectionPosition, isInteractive);
            }
        }
    }