Hello Danny,

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

You're on the right track with your subclass of osgGA::GUIEventHandler. This class's handle() can set the camera's view matrix using camera->setViewMatrix() (or the convenience setViewMatrixAsLookAt()).

Alternatively, you can subclass from osgGA::MatrixManipulator, override the handle() method to calculcate the new camera position, and override the getInverseMatrix() method to return that movement. Have a look at the source for osgGA::TrackballManipulator for an example. Then you give that manipulator to your osg::View / osgViewer::Viewer using setCameraManipulator(). This is the way that new camera movement modes are implemented generally.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    [email protected]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to