Clear() 공개 메소드

Reset the result.

public Clear ( ) : void
리턴 void
예제 #1
0
    // use screen midpoint as locked pointer location, enabling look location to be the "mouse"
    private PointerEventData GetLookPointerEventData()
    {
        VRCursorController cursor= VRCursorController.GetInstance();
        Vector3 lookPosition = cursor.GetCursorRaycastPosition(RAYCAST_OFFSET);
        RaycastHit testRayResult = new RaycastHit();

        if (m_hoverData == null)
        {
            m_hoverData = new PointerEventData(eventSystem);
        }

        m_hoverData.Reset();
        m_hoverData.delta = Vector2.zero;
        m_hoverData.position = lookPosition;
        m_hoverData.scrollDelta = Vector2.zero;

        Vector3 lookDirection = cursor.GetCursorRaycastDirection();
        Ray testRay = new Ray(lookPosition, lookDirection);

        RaycastResult raycastResult = new RaycastResult();
        raycastResult.Clear();

        if (Physics.Raycast(testRay, out testRayResult, RAYCAST_OFFSET+10.0f, UI_COLLISION_LAYER_MASK))
        {
            raycastResult.gameObject = testRayResult.collider.gameObject;
            raycastResult.depth = 0;
            raycastResult.distance = testRayResult.distance;
        }

        m_hoverData.pointerCurrentRaycast = raycastResult;

        if (m_hoverData.pointerCurrentRaycast.gameObject != null)
        {
            m_guiRaycastHit = true;
        }
        else
        {
            m_guiRaycastHit = false;
        }

        return m_hoverData;
    }