how to get mouse event

classic Classic list List threaded Threaded
1 message Options
peanutpig peanutpig
Reply | Threaded
Open this post in threaded view
|

how to get mouse event

 

 Hi My Osgearth program is a server. The program sends pictures to the web; I want to get the world coordinates, move the mouse on the web; I use the computeintersections function to calculate but return false; how should I calculate it?


Now I don't know how to trigger my mouse event, because the mouse move on the web.

 const osgGA::GUIEventAdapter*  padapter = _mainview->getEventQueue()->mouseButtonRelease(x,y,1);

    osgUtil::LineSegmentIntersector::Intersections       _intersections;
    if (view->computeIntersections(*padapter, _intersections, INTERSECT_IGNORE))
    {
        for (const auto &intersection : _intersections)
        {
            bool  visible = true;
            for (const auto node : intersection.nodePath)
            {
                // Only count the intersection in main view
                if ((node->getNodeMask() & SHOW_IN_WINDOW_1) == 0)
                {
                    visible = false;
                    break;
                }
            }
            if (visible)
            {
                _currentLocalPos    = intersection.getLocalIntersectPoint();
                _currentWorldPos    = intersection.getWorldIntersectPoint();
                return;
            }
        }
    }