[osg-users] Intersection with 2d plane embedded in 3d

Steve Hardy osgforum at tevs.eu
Mon May 20 18:22:14 PDT 2019


Trying to answer my own question by using the form of View::computeIntersections() which takes a node path parameter.  The following code (as a member of my View subclass) doesn't seem to work (even though the simpler deprecated form works)...


Code:

  osg::Geode* geode = ...;
  osgUtil::LineSegmentIntersector::Intersections intersections;
  osg::NodePathList npl = geode->getParentalNodePaths(getCamera());
  npl[0].push_back(geode);  // Not sure if this req'd, but it fails either way
  if (computeIntersections(getCamera(), osgUtil::Intersector::WINDOW, x,y, npl[0], intersections)) {
    printf("<have intersections>\n");
  }




It never gets to the printf.  (Yeah sorry but too late to teach this old dog to use cout).

Can't find any examples of creating node paths like this, so I'm probably not understanding how it works.  Do I need to push the camera node to the front?  The geode to the end?


Cheers,
Steve

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76121#76121







More information about the osg-users mailing list