Hi. I have question about MatrixTransform.
How should I reset position/rotation/scale using MatrixTransform?
[code]
{
osg::Matrix mat;
osg::Vec3d _Trans = MyMatrixTransform->getMatrix().getTrans();
osg::Quat _Rotate =MyMatrixTransform->getMatrix().getRotate();
osg::Vec3d _Scale = MyMatrixTransform->getMatrix().getScale();
MyMatrixTransform->setMatrix(osg::Matrix::scale(1.0f,1.0f,1.0f) *
osg::Matrix::rotate(0.0f,0.0f,0.0f,1.0f)*
osg::Matrix::translate(0.0f,0.0f,0.0f));
mat = osg::Matrix::scale(1.0f,1.0f,1.0f) *
osg::Matrix::rotate(0.0f,0.0f,0.0f,1.0f) *
osg::Matrix::translate(0.0f,0.0f,0.0f);
if (!scale) mat.preMult (osg::Matrix::scale(_Scale));
if (!rotate) mat.preMult (osg::Matrix::rotate(_Rotate));
if (!position) mat.preMult (osg::Matrix::translate(_Trans));
MyMatrixTransform->setMatrix (mat);
}
[/code]
After that rotation (
MyMatrixTransform->getMatrix().preMult(osg::Matrix::rotate(angle3,osg::Vec3d(0,0,1)));
)
depends from scale (when scale is 10.0, rotation (angle3 = 0.2) visually works
like angle3=0).
How should I reset position/rotation/scale correctly?
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org