Hi Dusten,

Has anyone implemented a picking solution that uses OSG's selection algorithm -without- utilizing viewer? I use sdl to handle window management and input, and bullet for physics (which could be fine for selecting objects in-scene later, but this it would be quite a hack to use bullet for gui element picking). The osgpick example only shows how to do picking through viewer, so are there any suggestions on how to proceed?

    osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector =
        new osgUtil::LineSegmentIntersector(
            osgUtil::Intersector::WINDOW, x, y );
    osgUtil::IntersectionVisitor iv(intersector.get());
    iv.setTraversalMask(/* mask of what you want pickable */);

    // Use your main camera here.
    camera->accept(iv);

    osgUtil::LineSegmentIntersector::Intersections::iterator it;
    for (it = intersector->getIntersections().begin();
         it != intersector->getIntersections().end();
         ++it)
    {
        // Do what you want with the intersections.
    }

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    [EMAIL PROTECTED]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to