Hi,

Another Nub Q:

I'm trying to move my camera forward and backward as the event of up/down key.

I created class CameraMover inherited from osgGA::GUIEventHandler.
I also have handle function with switch\case:

case(osgGA::GUIEventAdapter::KEYDOWN):
          {
             switch(ea.getKey())
             {
             case osgGA::GUIEventAdapter::KEY_Down:
                std::cout << " down key pressed" << std::endl;
                return false;
                break;
             case osgGA::GUIEventAdapter::KEY_Up:               
                std::cout << " up key pressed" << std::endl;
                return false;
                break;
             default:
                return false;
             } 
                  }

viewer.addEventHandler(new CameraMover()); 

I also understand that in order to move camera back and forward in need to 
perform camera->setViewMatrix(....) manipulation, but I'm failing to understand 
where and how should I call to the camera function and how to link this 
function to event handle function:

osg::Camera* camera = viewer.getCamera();
camera-> ?
 
Any help or example will be appreciated.
  
Thank you!

Cheers,
Danny

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=15116#15116





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to