Hello David, I'm by no means an expert in OSG, since I've been using it just for a couple of months and haven't read the whole code yet, but I do have an application with picking and can give you some insights from my experience.
hud_camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024)); > hud_camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); > hud_camera->setViewMatrix(osg::Matrix::identity()); > hud_camera->setClearMask(GL_DEPTH_BUFFER_BIT); > hud_camera->setRenderOrder(osg::Camera::POST_RENDER); > > what does the parameters of the osg::Matrix::ortho2D represent??? > The parameters set the projection matrix used in the HUD. I guess your world is displayed using a perspective projection, which basically simulates a 3D effect on your screen by drawing things that are far away smaller. This effect is undesired in a HUD, so an Orthogonal is generally used, which does not deform objects depending on their depth (z) values. The supplied parameters just set this projection, they are the position and size of your projection, which in this case starts at (0,0) and ends in (1280-1, 1024-1). > i can pick always in one of the three objects, never in the second and > sometimes in the last one > > i´ve tried to modify their Z values with no success > Z does not play a big role in Orthogonal projections. It may be best to think about the HUD in 2D. > the picking is done using a osgUtil::PickVisitor whichg intersects against > the HUD camera subgraph > > osgUtil::PickVisitor pick_visitor(hud_camera->getViewport(), > hud_camera->getProjectionMatrix(), > hud_camera->getViewMatrix(), (float) > mousex, (float) mousey); > > pick_visitor.apply(*(hud_camera.get())); > > where mousex and mousey represents the mouse coordinates > PickVisitor did not work for me. You should use osgUtil::LineSegmentIntersector, there is an example on how to use it in the OSG Examples. Hope this helps, Alejandro.- -- [EMAIL PROTECTED] http://varrojo.linuxuruguay.org
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

