Hi Tiago, I am not familiar with PositionAttitudeTransform (aware of it but never used it), so I will give you some hints how to do it with MatrixTransform instead. If your object is positioned in 3D at some point you have to translate the object back to 0, perform the rotation there around the center of the object and then translate it back to it's position in 3D.
something like this: osg::MatrixTransform* mxt = new osg::MatrixTransform; // let say your object is at x1,y1,z1 position in 3D osg::Matrixd translate1 = osg::Matrixd::translate(-osg::Vec3(x1,y1,z1)); osg::Quat rotate = osg::Quat(); // perform your rotation here osg::Matrixd translate2 = osg::Matrixd::translate(osg::Vec3(x1,y1,z1)); mxt->setMatrix( translate1 * rotate * translate2) Hope this gets you the idea Nick On Tue, May 13, 2014 at 8:56 PM, Tiago Martins <[email protected]>wrote: > Hi, > > I am trying to rotate an object using his center as reference.. > > This code is rotating the object using some point as reference, but I want > to rotate using the center point of the object. > > Did you understood? > > This is my code: > > > Code: > osg::PositionAttitudeTransform* heliceTransf = > static_cast<osg::PositionAttitudeTransform*>(node); > > osg::Quat q = heliceTransf->getAttitude(); > > q *= osg::Quat(0.0, osg::Y_AXIS, 0.0, osg::X_AXIS, 0.1, osg::Z_AXIS); > heliceTransf->setAttitude(q); > > > > Thank you! > > Cheers, > Tiago > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=59396#59396 > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- trajce nikolov nick
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

