[osg-users] Camera manipulator changes for inverted y axis

Tunc Bahcecioglu tuncbah at gmail.com
Fri Sep 30 01:22:22 PDT 2016


I reverted the y axis by adjusting the camera projection matrix:

camera->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(traits->width) / static_cast<double>(traits->height), 1.0f, 10000.0f);
auto originalProjection = camera->getProjectionMatrix();
osg::Matrixd reverseYMat;
reverseYMat.makeScale(osg::Vec3d(1.0, -1.0, 1.0));
camera->setProjectionMatrix(reverseYMat * originalProjection);

The code works, however I have a problem with the trackball manipulator.
The manipulator sets the home position reverse in Z direction: everything is positioned upside down. Furthermore when I rotate the camera the movement in the Z direction seems to be reversed.

What should I do to change the behavior of the manipulator to the expected one?

Thank you!


Read this topic online here:

More information about the osg-users mailing list