Hi Sanat, On 29/07/10 9:20 , Sanat Talmaki wrote: > I have 2 PAT nodes under a root node. I want to display the distance between > these 2 > nodes using simple distance formula at every run of the traversal. > > Currently I have the text box added to my keyboard event handler. And it > displays > updated information like which node is under control eveytime I hit a key. > However I want > to display the distance without having hit a key. > > Code: > TextBox * t1 = new TextBox(); > t1->setPosition(osg::Vec3d(0, 450, 0)); > t1->setText(str1); > ...... > osg::ref_ptr<KeyboardHandler> keh = new KeyboardHandler; > keh->setPAT(backhoe1PAT, backhoe2PAT); > keh->setTextBox(t1); > > If I add update callbacks to the individual nodes, I wont be able to access > the > position info of the other PAT. So I was wanting to know how I can go about > this issue.
You can do the calculation from the 'KeyboardHandler' object, it has all the necessary objects available. There is a 'osgGA::EventAdapter::FRAME' event type that you can check in the handle() method. Cheers, /ulrich _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

