Hi Danny; You mean it is not working or working but not as expected? I saw a problem you multiply matrices wrong order. You always obey the TRS rule. First Scale then Rotate and lastly Translate. But as I see you have done wrong order for
myCameraMatrix = cameraRotation * cameraTrans; HTH. Regards. Ümit Uzun 2009/7/21 Danny Lesnik <danny...@walla.co.il> > Hi Jean-Sébastien, > > Thank you for your reply i'm trying to do it by first method I implemented > some code but it looks like this code does nothing: > > bool CameraMover::handle(const osgGA::GUIEventAdapter& > ea,osgGA::GUIActionAdapter& us) > { > osg::Matrixd myCameraMatrix; > osg::Matrixd cameraRotation; > osg::Matrixd cameraTrans; > cameraRotation.makeRotate( > osg::DegreesToRadians(0.0), osg::Vec3(0,1,0), // roll > osg::DegreesToRadians(60.0), osg::Vec3(1,0,0) , // pitch > osg::DegreesToRadians( 45.0), osg::Vec3(0,0,1) ); // heading > cameraTrans.makeTranslate( 1,5,1 ); > myCameraMatrix = cameraRotation * cameraTrans; > osg::Matrixd i = myCameraMatrix.inverse(myCameraMatrix); > osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>( &us ); > > ........... > > switch(ea.getKey()) > { > case osgGA::GUIEventAdapter::KEY_Down: > > > viewer->getCamera()->setViewMatrix(i*osg::Matrix::rotate(-(osg::PI_2),1,0,0)); > return false; > break; > > ...... > } > > } > > int main() > { > ...... > > viewer.addEventHandler(new CameraMover); > viewer.realize(); > while( !viewer.done() ) > { > viewer.frame(); > } > > > Could you tell me please why my event is not working? > > Thank you! > > Cheers, > Danny > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=15152#15152 > > > > > > _______________________________________________ > 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