[osg-users] IntersectVisitor does not recognize Nodes on different Projection

Peter Hrenka p.hrenka at science-computing.de
Thu Nov 26 01:43:16 PST 2009

Hi Thorsten,

Thorsten Werner schrieb:
> Hi,
> I've got a loaded model which is a child of the root.
> the second child of the root node is a ortho2d projection, which i use for the GUI. Now i've taken the example osgkeyboardmouse from the osg site and my problem is that it only catches intersections with the loaded model. Not with the Goedes which are at the Ortho2D ProjectionMatrix.
> double w(.05), h(.05);
>         osgUtil::PolytopeIntersector* picker =
>                 new osgUtil::PolytopeIntersector(
>                 osgUtil::Intersector::PROJECTION,
>                 x-w, y-h, x+w, y+h);
>         osgUtil::IntersectionVisitor iv(picker);
>         viewer->getCamera()->accept(iv);
> this is how i configured the Visitor. I've tried to change the Intersector into a osg::Intersector::WINDOW. ut then absolutely nothing happens anymore. 

What kind of primitives are you trying to pick?
For Triangles/Quads it is more efficient to use the 
LineSegementIntersector (which is the default when you start
osgkeyboardmouse, you can toggle using 'p'). The osgpick example
always uses the LineSegementIntersector.

Assuming you want to use PolytopeIntersector, I have to say
that it not work well when Projections are involved.
To fix that properly we might need a completely different
As a workaround you could try to call PolytopeIntersector
on your (unprojected) HUD-Node directly and see if it helps.

> Thanks in advance.
> Cheers,
> Thorsten


Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, 
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196 

More information about the osg-users mailing list