Hello Martin,
I have try this way, but it doesn't work. I guess the manipulator needs more
information. For example, when I set the manipulator in the viewer via
addEventHandler(), it doesn't work. A manipulator must set with
setCameraManipulator().
Well I don't know much about what you're doing, just small bits of
information... Is "the manipulator" above your own manipulator or the
trackball manipulator?
What I thought you were doing was:
class MyCameraManipulator : public osgGA::CameraManipulator
{
public:
MyCameraManipulator() : osgGA::CameraManipulator(), _trackball(new
osgGA::TrackballManipulator) {}
virtual bool handle(ea, aa)
{
// handle my events
//at the end, call trackball so it also handles its events
return _trackball->handle(ea, aa);
}
virtual osg::Matrixd getInverseMatrix()
{
return _trackball->getInverseMatrix();
}
// ...
};
// in main()
viewer->setCameraManipulator( new MyCameraManipulator );
This should work, I think. If it doesn't then you need to start up your
debugger and trace what's going on, I can't do it for you...
The basic principle is that the view will call its camera manipulator's
getInverseMatrix() method once per frame to get the updated view matrix.
It won't do this for a general event handler set by addEventHandler()...
If you don't set a camera manipulator on your view(er), then you need to
pass it a view matrix some other way, because no one will call your
camera manipulator's getInverseMatrix()... So you can't set the
manipulator with addEventHandler(), it doesn't make sense, because the
camera manipulator is a special event handler whose getInverseMatrix()
method must be called.
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