Hi ??? Please use the mailing list convention of signing with the name
you wish to be addressed with,
Might I recommend you use osg::PositionAttitudeTransform? This
manages the potioning, scaling, rotation and pivot point all as
separate variables so there is no need to try an decompose a Matrix
into its part and recombine.
Robert.
On Wed, Nov 5, 2008 at 5:47 AM, GMD GammerMaxyandex.ru
<[EMAIL PROTECTED]> wrote:
> 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
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org