Hi Tom,

Yes, I should have probbaly tried outputting values to the console a little 
earlier. It appears there is a bug in VS 2005 while setting a watch on  
variables in member functions in classes.

So I have managed to narrow down my problem to the following lines of code:

xPos and yPos are legitimate value.
However backhoeContactPoint.x and .y show 0 as output. 

I also noted that the Intersection backhoeIntersection has its member matrixd 
showing: error unable to access inavlid memory location.

But this method was working for me when I was updating position through 
keyboard input.


Code:
//PROBLEM STARTS FROM HERE AS CONSOLE OUTPUT SHOWS VALUE 0:
  osgUtil::LineSegmentIntersector* backhoeLocationSegment = 
                   new osgUtil::LineSegmentIntersector(
                               osg::Vec3d(xPos, yPos, 99999),
                               osg::Vec3d(xPos, yPos, -99999));
        osgUtil::IntersectionVisitor findBackhoeElevationVisitor;
  findBackhoeElevationVisitor.setIntersector(backhoeLocationSegment);
        surface->accept(findBackhoeElevationVisitor);
        osgUtil::LineSegmentIntersector::Intersection backhoeIntersection = 
                                             
backhoeLocationSegment->getFirstIntersection();
        osg::Vec3d backhoeContactPoint = 
backhoeIntersection.getWorldIntersectPoint();
        Console::WriteLine("backhoeContactPoint.x: {0}", 
backhoeContactPoint.x());
        Console::WriteLine("backhoeContactPoint.y: {0}", 
backhoeContactPoint.y());
        return backhoeContactPoint;




What can I infer from this ?

Thanks,

Sanat

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





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to