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

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


Hi,

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

Code:
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!

Cheers,
tunc

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








More information about the osg-users mailing list