Hi David, On 31/08/09 12:16 PM, David Goering wrote:
I have: osg::ref_ptr<osg::MatrixTransform> arTransform = new osg::MatrixTransform();and if I understand it all correctly, that is constantly updated by the cameras marker coordinates. Is there an easy way to access the x,y,z values and update them? My approach was this: osg::Matrix mtrx = arTransform->getMatrix(); osg::Quat* q = new osg::Quat(); mtrx.get(*q); int x = q->x(); int y = q->y(); int z = q->z(); in order to get x,y,z but this always returns 0 for each value. And then: mtrx.setTrans(x,y,z); arTransform->setMatrix(mtrx); (obviously this would set the matrix to its original values)
I didn't follow what you're trying to do, but putting the rotation quaternion back into the translation doesn't make sense. (osg::Matrix::get is deprecated, getRotate() is what should be used instead.)
The quat is probably 0,0,0,1 because there is no rotation part of the matrix. If you need to get the translation part of a matrix use 'osg::Vec3 osg::Matrix::getTrans()' Apart from that: osg::Vec3 trans = arTransform->getMatrix().getTrans(); osg::Matrix mtx; mtx.setTrans(trans.x, trans.y, trans.z); arTransform->setMatrix(mtx); is the correct way to update the MatrixTransform. Cheers, /ulrich _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

