Hi Gianluca

You say you wish to get the nearest intersection with the PolytopeIntersector...

I think the mistake is here:
osg::NodePath& nodePath = 
/*picker->getFirstIntersection()*/closestIntersection.nodePath;

If you want to have the nearest intersection, you must get the first 
intersection from the picker...
osg::NodePath& nodePath = picker->getFirstIntersection();

We also use the Polytope Intersector in our Project. And it works great!
Daniel


Am Donnerstag, 10. Januar 2008 18.46:18 schrieb Gianluca Natale:
> Hi all!
>
>
>
> I'm trying to use a osgUtil::PolytopeIntersector
>
> to find the closest object in my 3D scene graph (with OSG ver.2.2).
>
> I read on the OSG QSG that it should return the closest object
>
> as the first in the list of intersections.
>
> But it is not like that!
>
> I mean that the array of intersections correctly contains all of
>
> the objects hit by the intersection volume,
>
> but the first of those is not necessary the closest.
>
> BTW, it seems to be the object with the shortest node path. Might it be?
>
>
>
> Any idea of my mistake?
>
>
>
> Thank you in advance.
>
>
>
> Gianluca
>
>
>
> P.S.=attached is the source file (look into the class PickHandler,
>
>     in the method pick; first I tried getting directly the first
> intersection in
>
>         the list, picker->getFirstIntersection(); then I tried to sort
>
>         the intersection on my own. But I pick always the background
> rectangle!)


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

Reply via email to