Hi guys,

I want to have the coordinates of the mouse in Object
coord. sys. (Coordinate System) in my statuse bar.
I've used the osgUtil::SceneView,
osgGA::KeySwitchMatrixManipulator and
osgGA::TrackballManipulator. I've used

sceneView->projectWindowIntoObject( osg::Vec3(e->x(),
height()-e->y(),0.0f), opt);

to get the coordinates of the mouse pointer (Z coord.
is not important at this point).

But as soon as I pan/rotate the scene the coordinates
are not anymore correct, since I have the coordinate
axis in the screen and the origin is not anymore
(0,0,0). Its coordinates are changing by the same
factor as pan/rotation. But in reality when we move a
camera there should be no changing in the coordinate
of the objects.

So here is the question:
why does it happen and how can I fix it? (to move the
camera not the objects)

The second question:
when I use glUnProject it does not get the same
coordinate as the projectWindowIntoObject. what is
wrong in between? 

PS: I used the above functions after sceneView->draw()
as the documentation says. Also I tried to update the
manipulator matrix by the following code before coord.
queries:

if (keyswitchManipulator.valid() &&
keyswitchManipulator->getCurrentMatrixManipulator()) 
{
 osgGA::MatrixManipulator* mm =
keyswitchManipulator->getCurrentMatrixManipulator();
 osg::Matrixd matrix = mm->getInverseMatrix();
 sceneView->setViewMatrix(matrix);
}

but again the problem is remained.

Thanks in advance for your attention and possible
solutions.

All the best
Soheil



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to