Code:
osg::MatrixTransform *m_rotation = new osg::MatrixTransform();
osg::Quat rotacion(transform2->getRotation()->a, OSGTypesMapping::sFRotationPtrToOsgVec3_ShiftAxis(transform2->getRotation()));
osg::Matrix m;
m.setRotate(rotacion);
m_rotation->setMatrix(m);
m_rotation->addChild(<<NodeIWantToTransform>>);
osg::MatrixTransform *scale = new osg::MatrixTransform();
osg::Matrix m2;
m2.makeScale(transform2->getScale());
scale->setMatrix(m2);
scale->addChild(m_rotation.get());
osg::MatrixTransform *translate = new osg::MatrixTransform();
osg::Matrix m3;
m3.setTrans(transform2->getTranslation());
translate->setMatrix(m3);
translate->addChild(scale);
and then I add the translate node to my camera view.
My problem is that I need to use only one MatrixTransform, but if I make:
Code:
osg::MatrixTransform *mt = new osg::MatrixTransform;
osg::Matrix m;
m.setRotate(...);
m.makeScale(...);
m.setTrans(...);
mt->setMatrix(m);
It doesn't work, rotations doesn't make any effect!!!!
Do someone know how can I make it using only one MatrixTransform??? Is it possible???
Thank you!!!
Cheers,
Manuel
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=28265#28265
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
as far as I know, you can only make rotate/translate/scale once on a matrix because it resets the prior values.
But you can always create a matrix as you did, and add its operation via multiplying your temporary matrix with the final matrix. This way you can sum up your operations in one matrix.
Cheers,
Torben
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=28266#28266
If you want to set the scale, rotation and translation seperately then
use an osg::PositionAttitudeTransform.
Robert.