Hi, Using the draggerHandler (the copy of the one in osgManipulator example) to rotate and translate a node, I need to get theses transformations to apply it to an other node.
In the Handler, I get the previous matrix of the dragger, and after transformation (on release) I get the other matrix. If I print the values : * DISPVECT("relative trans", afterMoving.getTrans() - _beforeMoving.getTrans()); DISPQUAT("relative rot ", afterMoving.getRotate() * _beforeMoving.getRotate().inverse());* It looks very good. Next, to apply theses transformation to an osg::Plane, I use this code : * osg::Vec3d trans = afterMoving.getTrans() - beforeMoving.getTrans(); osg::Quat rot = afterMoving.getRotate() * beforeMoving.getRotate().inverse(); //Create the transformation matrix to rotate and translate the plane. the plane has its center int the center of the Dragger osg::Matrixd m ; m = osg::Matrixd::translate(-beforeMoving.getTrans()) * osg::Matrixd::rotate(rot) * osg::Matrixd::translate(beforeMoving.getTrans()) * osg::Matrixd::translate(trans); DISPVECT("relative plane trans", m.getTrans()); DISPQUAT("relative plane rot ", m.getRotate()); myPlane->transform(m);* The value applied are not the same ! values returned : *relative trans : 0 0 0 relative rot : 1.63503e-008 -0.461046 2.45062e-008 0.920392 relative plane trans : 3081.37 -7.26342e-005 -3422.35 relative plane rot : 1.58832e-008 -0.447874 2.38061e-008 0.894097* The translation result looks good, but the rotation is not exactly the good one... Do you have any idea of where to find why there is a difference ? May be a math problem, or a plane->transform not adapted to that kind of computation ... ? Thanks a lot. Regards, Vincent.
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org