Thank you, Rafa! Sorry for late answer. Happy new year! Rafa Gaitan wrote: > Hi Drake, > > osg::PositionAttitudeTransform does not inherit from osg::MatrixTransform > (http://trac.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a00618.html > > (http://trac.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a00618.html)) > that's why that method always returns NULL. Internally it's implemented as: > return dynamic_cast<osg::MatrixTransform*>(this); > > > To convert the PAT to a MatrixTransform you need to get the Position, the > Rotation and the Scale of the PAT and create your own osg::Matrix using those > three values, then set that Matrix to your osg::MatrixTransform: > > > osg::Matrix m = > osg::Matrix::scale(pat->getScale())*osg::Matrix::rotate(pat->getAttitude())*osg::Matrix::translate(pat->getPosition()); > osg::MatrixTransform *mt = new osg::MatrixTransform(); > mt->setMatrix(m); > > > Cheers, > Rafa. > > > > > 2014-12-29 14:23 GMT+01:00 Drake Aldwyn < ()>: > > > Hi, guys > > > > I've stuck. Please help me get out. > > I have PositionAttitudeTransform, I use it because i need to know position > > of node. But for manipulation with it ( i use osggizmo from osg recipes) i > > need to transform this PAT to matrixTransform. > > using object->asMatrixTransform(); > > returns NULL without matrix. What wrong with my actions. Or is it there > > another way how can i transform PAT to MatrixTransform? > > Thank you! > > > > Cheers, > > Drake > > > > ------------------ > > Read this topic online here: > > http://forum.openscenegraph.org/viewtopic.php?p=62203#62203 > > (http://forum.openscenegraph.org/viewtopic.php?p=62203#62203) > > > > > > > > > > > > _______________________________________________ > > osg-users mailing list > > () > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > > > -- > Rafael Gaitán Linares > CTO at Mirage Technologies S.L - http://www.mirage-tech.com > (http://www.mirage-tech.com) > > ------------------ > Post generated by Mail2Forum
------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62220#62220 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org