Hi,

Here's my problem.
I have affected a nodetrackmanipulator to a viewer and a callback to the camera.

I want is to compel my camera inside a sphere.

So,  in the callback method  operator() I get the nodetrackmanipulator,
get the position matrix mat from it using getMatrix().

Then I compute the lenght of the position the camera (this is done in the 
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) method) : 

[code]
osg::Matrixd mat = _nodeTrackerManipulator->getMatrix();
double length = mat.getTrans().length();

if (length > sphereRadius)
{
        osg::Matrixd newMat;
        newMat.identity();
        newMat.setRotate( m.getRotate() );
        newMat.setTrans( 0, 0, 0); 
        _nodeTrackerManipulator.setByMatrix( newMat );
}
[/code]

The problem is that the display result is wrong. The camera is not at position 
(0,0,0).
I have also try using setByInverseMatrix but nothing.

What should it done to update the position, rotation nodeTrackerManipulator 
(matrixManipulator) ?

Thank you.

[/code]

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to