Hello OSG mailinglist users,
I have a problem with the osg::IntersectVisitor at osg V2.0. I will use the IntersectVisitor to detect a hit between a 3Dmodel and a ray (LineSegment), so I build a testprogram based on the http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/Inters ections example (for osg V1.2). After modifing the code for osg v2.0 (the viewer part) i had an error at "terrainNode->accept(findTankElevationVisitor);" Error description: Unhandled exception at 0x104817fd (msvcp80d.dll) in ATest1.exe: 0xC0000005: Access violation writing location 0x000000a4. Is there maybe a problem with the IntersectVisitor and OSG v2.0? With best regards Gerald T My hit-detection testprogram: #include <iostream> #include <string> #include <sstream> #include <osgUtil/IntersectVisitor> #include <osg/LineSegment> #include <osg/Geometry> #include <osg/Texture2D> #include <osg/Billboard> #include <osg/BlendFunc> #include <osgDB/Registry> #include <osgDB/ReadFile> #include <osgViewer/Viewer> #include <osg/PositionAttitudeTransform> #include <ctime> #include <cstdlib> using namespace std; int main( int argc, char **argv ) { osg::Group* rootNode = new osg::Group(); osg::Node* terrainNode = NULL; terrainNode = osgDB::readNodeFile("D:\\Smpl\\Data\\Images\\Textures\\13-warncone_model .3DS"); if (! (terrainNode)) { std::cout << "Couldn't load models, quitting." << std::endl; return -1; } rootNode->addChild(terrainNode); double tankXPosition = -10.0; double tankYPosition = -10.0; osg::LineSegment* tankLocationSegment = new osg::LineSegment(); tankLocationSegment->set( osg::Vec3(tankXPosition, tankYPosition, 999) , osg::Vec3(tankXPosition, tankYPosition, -999) ); osgUtil::IntersectVisitor findTankElevationVisitor; findTankElevationVisitor.addLineSegment(tankLocationSegment); terrainNode->accept(findTankElevationVisitor); // Error: Unhandled exception at 0x104817fd (msvcp80d.dll) // in ATest1.exe: 0xC0000005: Access violation writing location 0x000000a4. osgUtil::IntersectVisitor::HitList tankElevationLocatorHits; tankElevationLocatorHits = findTankElevationVisitor.getHitList(tankLocationSegment); osgUtil::IntersectVisitor::HitList& hits = findTankElevationVisitor.getHitList(tankLocationSegment); //hits[0].getWorldIntersectPoint(); osgViewer::Viewer viewer; viewer.setSceneData(rootNode); return viewer.run(); }
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

