Re: [osg-users] Compel a camera (using MatrixManipulator) inside a sphere

2009-10-02 Thread Miguel Lokida
A little up to see if someone can have an idea.

Thanks !

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Compel a camera (using MatrixManipulator) inside a sphere

2009-10-01 Thread Miguel Lokida
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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org