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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org