I found one solution : after verifications the sequence is : * viewer->advance() * manipulator->_frame() : compute camera position * viewer->event() * callback : node moving * manipulator->getinversematrix : set camera position * ...
so the position of the camera is computed before node is moved... To solve it, I just add a _frame() call just before the manipulator->getInverseMatrix... If anyone have the same problem, it can be the solution. If anyone have a better idea, I am always curious to know it. Thanks, Regards, Vincent. 2008/7/9 Vincent Bourdier <[EMAIL PROTECTED]>: > Hi all, > > I have a similar problem than > http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2008-June/012275.htmlbut > I did not succed to solve the problem... > > This is the whole problem : > > I've done a manipulator (matrix manipulator), which permit to make the > camera follow a node. > The node is moved by an UpdateCallback on a other node. > The manipulator's camera position is computed in a _frame() method : > > bool MyManipulator::handle(const osgGA::GUIEventAdapter& ea, >> osgGA::GUIActionAdapter& us){ >> [...] >> case(osgGA::GUIEventAdapter::FRAME): >> _frame(); >> [...] >> } > > > In the frame method, I get the world position of the node, and set the > camera's position doing something like this : > > osg::Matrixd MyManipulator::getInverseMatrix() const{ >> return >> osg::Matrixd::translate(_eye+_vCorrectionGoto)*osg::Matrixd::rotate((_rotation).inverse()); >> } >> > > with eye = eye + node_translation > > my render loop is : > > while(!pViewer->done() && !masterKilled ) >> { >> pViewer->advance(); >> pViewer->eventTraversal(); >> pViewer->updateTraversal(); >> >> actionBetweenFrames(contextID); //just update some node in >> the scene graph (switch add and remove child) >> pViewer->renderingTraversals(); >> } >> > > But when I put the camera behind a node, the camera is shaking in the axis > translation (not allong Z axis when node is moving in XY plane)... It looks > something must un-synchronized... > > Any idea ? > > thanks. > > Regards, > > Vincent >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org