The scene graph that you perform the pick on doesn't have to be the same scene graph as the one you display, if that helps.
Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com +1 303 859 9466 -----Original Message----- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul Griffiths Sent: Thursday, May 21, 2009 9:26 AM To: osg-users@lists.openscenegraph.org Subject: [osg-users] Picking and ignoring clipped parts of models? Hi, Im using code based on the osgpick example, im clipping a model so some of is it is invisible on screen. But I can pick the part with the mouse pointer even though that part of the model is invisible, is there an easy way for the pick code to ignore cliped parts? heres my code, my PWidgetBase class is inhereted from osg::Group class [code] PWidgetBase* PWidgetHandler::pick(osg::ref_ptr<osgViewer::View> view, const osgGA::GUIEventAdapter& ea) { osgUtil::LineSegmentIntersector::Intersections intersections; std::string gdlist=""; float x = ea.getX(); float y = ea.getY(); #if 0 osg::ref_ptr< osgUtil::LineSegmentIntersector > picker = new osgUtil::LineSegmentIntersector(osgUtil::Intersector::WINDOW, x, y); osgUtil::IntersectionVisitor iv(picker.get()); view->getCamera()->accept(iv); if (picker->containsIntersections()) { intersections = picker->getIntersections(); #else if (view->computeIntersections(x,y,intersections)) { #endif for (osgUtil::LineSegmentIntersector::Intersections::iterator hitr = intersections.begin(); hitr != intersections.end(); ++hitr) { if (!hitr->nodePath.empty()) { osg::Node* node = hitr->nodePath.back(); if (node && node->getNumParents() > 0) { node = node->getParent(0); while (node != NULL) { if (node && strcmp(node->className(), "PWidgetBase") == 0) { PWidgetBase* obj = (PWidgetBase*)node; if (obj) { return obj; } } if (node->getNumParents() > 0) node = node->getParent(0); else break; } } } else if (hitr->drawable.valid()) { return NULL; } } } return NULL; }; [/code] ... Thank you! Cheers, Paul ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12680#12680 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org