thanks again for your help : but i have another problem :
while( !viewer.done() || !viewer1.done() ) { viewer.getCamera()->getViewMatrixAsLookAt(eye, center, up); cout << "eye2 " << eye.x() << " " << eye.y() << " " << eye.z() << endl; cout << "center " << center.x() << " " << center.y() << " " << center.z() << endl; cout << "up " << up.x() << " " << up.y() << " " << up.z() << endl; osg::Matrixd m(viewer.getCamera()->getViewMatrix()); mt->setMatrix(osg::Matrix::translate(eye.x(),eye.y(),eye.z())* osg::Matrix::rotate(m.getRotate().inverse())); i tried m.getRotate().inverse() and m.getRotate() they rotate the object but i the wrong way they flip it does any one have recomendations ?? --- On Wed, 12/17/08, Vincent Bourdier <vincent.bourd...@gmail.com> wrote: > From: Vincent Bourdier <vincent.bourd...@gmail.com> > Subject: Re: [osg-users] my current position > To: olfat_ibra...@yahoo.com > Date: Wednesday, December 17, 2008, 9:58 AM > You can do it using different things: > > * You get eye, center, up . With theses vector, you can > compute the front, > up, side vectors of the camera, an so compute the rotation. > (eye is camera position, center is the point the camera > look at) > > * You can get the matrix from the manipulator, and > getRotation from it. You > will have the quaternion representing the rotation. (or > rotation inverse, I > don't remember) > > * you can get the matrix from manipulator, and use > getFrontVector(...), > getSidevector() and getUpVector() from it. After that, just > compute the > rotation. > > Vincent. > > > 2008/12/17 olfat ibrahim <olfat_ibra...@yahoo.com> > > > you were right thank you very much > > now i need to get the H P R > > > > by H P R i mean the rotation arround x ,y , z axis . > > > > > > i tried the three functions in the following mannare : > > > > osg::Vec3f eye; > > osg::Vec3f center; > > osg::Vec3f up; > > > > osg::Vec3f eye1; > > osg::Vec3f center1; > > osg::Vec3f up1; > > > > osg::Vec3f position; > > osg::Matrixd > m(keyswitchManipulatorL->getCoordinateFrame(position)); > > > > while( !viewer.done() || !viewer1.done() ) > > { > > cameraL->getViewMatrixAsLookAt(eye1, > center1, up1); > > > viewer.getCamera()->getViewMatrixAsLookAt(eye, center, > up); > > osg::Matrixd > > > m(keyswitchManipulatorL->getCoordinateFrame(position)); > > // cout << position.x << > position.y << position.z << endl; > > cout << "eye " << > position.x() << " " << position.y() > << " " > > << position.z() << endl; > > > > cout << "eye " << > eye.x() << " " << eye.y() << > " " << > > eye.z() << endl; > > cout << "center " > << center.x() << " " << > center.y() << " " > > << center.z() << endl; > > cout << "up " << > up.x() << " " << up.y() << > " " << up.z() << > > endl; > > > > > > cout << "eye " << > eye1.x() << " " << eye1.y() << > " " << > > eye1.z() << endl; > > cout << "center " > << center1.x() << " " << > center1.y() << " > > " << center1.z() << endl; > > cout << "up " << > up1.x() << " " << up1.y() << > " " << up1.z() > > << endl; > > // fire off the cull and draw traversals of the > scene. > > viewer.frame(); > > } > > > > can any ong give me ideas ?? > > > > > > --- On Wed, 12/17/08, Vincent Bourdier > <vincent.bourd...@gmail.com> wrote: > > > > > From: Vincent Bourdier > <vincent.bourd...@gmail.com> > > > Subject: Re: [osg-users] my current position > > > To: olfat_ibra...@yahoo.com, "OpenSceneGraph > Users" < > > osg-users@lists.openscenegraph.org> > > > Date: Wednesday, December 17, 2008, 9:37 AM > > > Hi, > > > > > > 2008/12/17 olfat ibrahim > <olfat_ibra...@yahoo.com> > > > > > > > > > > > > > > > > > > > --- On Wed, 12/17/08, olfat ibrahim > > > <olfat_ibra...@yahoo.com> wrote: > > > > > > > > > From: olfat ibrahim > > > <olfat_ibra...@yahoo.com> > > > > > Subject: my current position > > > > > To: "OSG" > > > <osg-users@lists.openscenegraph.org> > > > > > Date: Wednesday, December 17, 2008, > 9:01 AM > > > > > i am using keyswitchManipulator : > > > > > > > > > > i need to print my current location > while iam > > > driving in > > > > > the scene : > > > > > > > > > > i tried the functions : > > > > > > > > > > keyswitchManipulatorL->getMatrix() > > > > > > viewer.getCamera()->getViewMatrixAsLookAt(eye, > > > center, > > > > > up) > > > > > > > > > eye is camera position. > > > > > > > > > > > > > > > cameraL->getViewMatrixAsLookAt(eye, > center, > > > up) > > > > > > > > > > all of those does not get me my moving > statuse . > > > > > i need my x,y,z and h,p,r current > position ; > > > > > > > > > > > > > > Are you sure you get the position each frame ? > because > > > theses functions will > > > give you > > > vector copy, so if you don't get them each > frame, they > > > will not change. > > > > > > What do you meen by h,r,p ? second camera > position ? > > > > > > Vincent. > > > > > > > > > > > is there a function should i call to > get me what > > > i need ? > > > > > > > > > > thanks > > > > > > > > > > > > > > > > > _______________________________________________ > > > > osg-users mailing list > > > > osg-users@lists.openscenegraph.org > > > > > > > > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > > > > > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org