Hei Robert.

I would like to do that, but im working in a company and right now im trying to 
integrating osg in a existing rendring system (which handles events, mfc 
window, renders 3d terrain++) for rendering simple objects, so i'd rather use 
SceneView as for now.

I think i could be using LineProjector and IntersectVisitor to find 
intersections..? But havent testet yet. See attachment.

Erlend


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Osfield
Sent: 17. april 2008 22:22
To: OpenSceneGraph Users
Subject: Re: [osg-users] picking osg objects using osgUtil::SceneView (cant 
find osgUtil::PickVisitor!)

Hi Erland,

Would it not be possible just to use osgViewer rather than SceneView.
One of the points of osgViewer is that it provides more higher level
functionality that users commonly require, and in doing so avoid the
pain of end users having to implement themselves, and the pain
involved in trying to communicate all the low level details required
to teach a 3rd party how to implement something already implemented
for them.

Robert.

On Thu, Apr 17, 2008 at 8:49 PM,  <[EMAIL PROTECTED]> wrote:
>
>
>
>
> I want to pick osg objects in the scene when pressing the mouse button on
> them.  I am using sceneView so i guess i cant use the osgViewer::View.
> computeIntersections and i
>
> did not find PickVisitor! Im using osg 2.3.7. So i guess i have to use
> IntersectVisitor. Is there a utility function for getting a line from camera
> towards mouse position. Or do i: camera.pos - gluUnproject screen to world
>
>
>
> erlend
> _______________________________________________
>  osg-users mailing list
>  osg-users@lists.openscenegraph.org
>  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
        osgManipulator::PointerInfo pInfo;
        pInfo.setMousePosition(mouse_x, mouse_y);
        pInfo.setCamera(_sceneViewer->getCamera());
        osg::ref_ptr<osgManipulator::LineProjector> lineProj = new 
osgManipulator::LineProjector;
        osg::Vec3 point;
        lineProj->project(pInfo, point);
        osg::ref_ptr<osg::LineSegment> pickLine = new 
osg::LineSegment(lineProj->getLineStart(), lineProj->getLineEnd());

        osgUtil::IntersectVisitor visitor;
        //visitor.setEyePoint(_sceneViewer->getCamera()->getPosition());
        visitor.addLineSegment(pickLine.get());
        _root->accept(visitor);
        osgUtil::IntersectVisitor::HitList hitList = 
visitor.getHitList(pickLine.get());

         osgUtil::Hit firstHit = hitList.front();
        std::string id = firstHit.getDrawable()->getName();
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to