Hi All, I have a problem about rotating one MatrixTransform node with 2 different Matrix which one of responsible for rotation on X by osg::X_AXIS and one of responsible for rotatin by osg::Y_AXIS. I have done some rotation to MT node but after this operations I am waiting to get Identity matrix for MT which has Identity matrix in initial state. Some psudo codes;
------------------------------------------------- // Initial states osg::MatrixTransform* MT; MT->setMatrix( osg::Matrix::identity() ); osg::Matrix ang1 = osg::Matrix::identity(); osg::Matrix ang2 = osg::Matrix::identity(); // Updates done with this codes ang1.preMult(osg::Matrix::rotate(osg::Quat(osg::DegreesToRadians(10.0f), osg::X_AXIS))); ang2.preMult(osg::Matrix::rotate(osg::Quat(osg::DegreesToRadians(10.0f), osg::Y_AXIS))); MT->setMatrix(ang2 * ang1); ------------------------------------------------- if I rotate my MT by above code; model rotated on Y by localCoordinate axis and rotated on X fixedCoordinate axis. But I wanted to rotate on X local coordınate axis too. If I use one matrix to update rotation; ------------------------------------------------- // Initial states osg::MatrixTransform* MT; MT->setMatrix( osg::Matrix::identity() ); osg::Matrix ang1 = osg::Matrix::identity(); // Updates done with this codes ang1.preMult(osg::Matrix::rotate(osg::Quat(osg::DegreesToRadians(10.0f), osg::X_AXIS))); ang1.preMult(osg::Matrix::rotate(osg::Quat(osg::DegreesToRadians(10.0f), osg::Y_AXIS))); ang1.preMult(osg::Matrix::rotate(osg::Quat(osg::DegreesToRadians(-10.0f), osg::X_AXIS))); ang1.preMult(osg::Matrix::rotate(osg::Quat(osg::DegreesToRadians(-10.0f), osg::Y_AXIS))); MT->setMatrix(ang1); ------------------------------------------------- With above code I can rotate my model X and Y local coordinate axis. But this code has lack too. After apply positive and negative way rotation I am waiting to get IdentityMatrix but after all rotation operation my MT->getMatrix() give me different from IdentityMatrix. I think I should use inverse matrix instead of negative direction rotated matrix to rotate -X or -Y direction. Could it solve my problem or not? By these 2 rotation operations my main goal is that; I want to rotate MT by X and Y local coordinate system. And after all rotations I can get initial state of MT. I mean I apply to many rotation transformation to my unique node and after all dual(for X and -X or for y and -Y with unordered queue) operation I want to get first initial matrix for my MT node. I know this is not hard operations, but I am unstable about choosing which one is right way. I appreciate any comments. Regards. Ümit Uzun
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org