I'm not 100% sure, but I think I remember we had an odd problem with our qt osg 
integration where we had to reverse the 'y' direction of the event, so that may 
be worth a try.
Also, I don't think it's unusual to get two intersections for one geometry if 
it's a closed convex shape because the ray will intersect two triangles, and 
you would typically ignore the triangle whose normal is facing away from you.
Chris Denham.


Hartmut Leister wrote:
> Hello all,
> 
> I got a problem with osgUtil::computeIntersections(). I wanted to include it 
> in my application (which is nested into the osgviewerQT example). I took the 
> code for picking from the osgpick example.
> However, when I click on my view, there's the following possibilities
> - the picked node/drawable is correct, but listed twice
> - no intersection is computed, although I clicked on a drawable
> - an intersection is computed, although i clicked into empty space
> 
> I can't explain, what I could be doing wrong. Perhaps it's that event comes 
> from QMouseEvent and has another coordinate system than osgviewer?
> 
> Any hints where to go from here?
> 
> Best wishes
> Hartmut
> 
> 
> Code:
> 
> void ViewerQT::mouseReleaseEvent( QMouseEvent* event )
> {
> // default mouse control
> AdapterWidget::mouseReleaseEvent(event);
> 
> // continue with picking
> osgUtil::LineSegmentIntersector::Intersections intersections;
> float x = event->x();
> float y = event->y();
> 
> std::cout << "(" << x << "," << y << ")";
> std::cout << std::endl;
> 
> if (computeIntersections(x,y,intersections))
> {
> for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = 
> intersections.begin();
> hitr != intersections.end();
> ++hitr)
> {
> if (!hitr->nodePath.empty() && !(hitr->nodePath.back()->getName().empty()))
> {
> // the geodes are identified by name.
> std::cout << "Object \""
> << hitr->nodePath.back()->getName()
> << "\""
> << std::endl;
> }
> else if (hitr->drawable.valid())
> {
> std::cout << "Object \""
> << hitr->drawable->getName()
> << "\""
> << std::endl;
> }
> }
> }
> 
> -- 
> frag nicht - du könntest eine antwort erhalten
> 
> NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!             
> Jetzt informieren: http://www.gmx.net/de/go/freephone
> _______________________________________________
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  ------------------
> Post generated by Mail2Forum


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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to