thanks the intersection now work fine, but I still have the problem that I need to use the function: computeNearFarPoints I need this function to compute the coordinate of the world with specific z value, that correspond to (x,y) on the screen, so I can know how much to move the object. (I need to know when the mouse move on the screen how much he move in the world, in a specific z value?)
how I can do this? thanks NB On 12/5/06, bertrand greslier <[EMAIL PROTECTED]> wrote:
Hi, you can see cooki3d c++ api<http://bertrand.greslier.free.fr/mamboV4.6/index.php?option=com_content&task=view&id=44&Itemid=53>class EnvironnmentGeneric.cpp function bool EnvironnementGeneric::computeIntersections(float x, float y, osgUtil::IntersectVisitor::HitList& hitlist, osg::Node::NodeMask mask) it use file also the file PickIntersectVisitor.h it is a an api very inspired from osgProducer and work with all GUI... Regards, Bertrand. On 12/5/06, benny porat < [EMAIL PROTECTED]> wrote: > > Hi, > I build an event handler for picking and everything work fine, we do > something like that > bool KEYBOARD_EVENT_HANDLER::handle(const osgGA::GUIEventAdapter& > ea,osgGA::GUIActionAdapter& aa) > { > switch(ea.getEventType()) > { > case(osgGA::GUIEventAdapter::PUSH): > { > osgProducer::Viewer* viewer = > dynamic_cast<osgProducer::Viewer*>(&aa); > float x = ea.getX(); // x,y screen > float y = ea.getY(); > osgUtil::IntersectVisitor::HitList benny; > if (viewer->computeIntersections(x,y,benny)) > { > . > . > . > osg::Vec3 v1,v2; > viewer->computeNearFarPoints(x,y,0,v1,v2); > . > . > . > } > } > } > } > Now, I need to use GUI for my program so I use QT4, and I use Robert > example. > the problem is that the dynamic_cast return me NULL... > so I try to find intersection without the viewer, I study > osgUtil::IntersectVisitor, but there is a problem I don't know how to > convert me screen point(the one that I get from the osgGA::GUIEventAdapter). > another problem that I need to find the world coordinate of a given > point in the screen and a given z value until know I use the > computeNearFarPoints function to calculate it. > > what I can do? > there is a way to work with viewer after all? > there is another way to find intersection? > there is replacement to those function that I can use? > > > thanks > NB > > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ > > -- Bertrand Greslier http://www.cooki3d.org _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
