[osg-users] Camera shaking

Vincent Bourdier vincent.bourdier at gmail.com
Wed Jul 9 00:41:42 PDT 2008


Hi all,

I have a similar problem than
http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2008-June/012275.htmlbut
I did not succed to solve the problem...

This is the whole problem :

I've done a manipulator (matrix manipulator), which permit to make the
camera follow a node.
The node is moved by an UpdateCallback on a other node.
The manipulator's camera position is computed in a _frame() method :

bool MyManipulator::handle(const osgGA::GUIEventAdapter& ea,
> osgGA::GUIActionAdapter& us){
> [...]
> case(osgGA::GUIEventAdapter::FRAME):
>             _frame();
> [...]
> }


In the frame method, I get the world position of the node, and set the
camera's position doing something like this :

osg::Matrixd MyManipulator::getInverseMatrix() const{
>         return
> osg::Matrixd::translate(_eye+_vCorrectionGoto)*osg::Matrixd::rotate((_rotation).inverse());
> }
>

with eye = eye + node_translation

my render loop is :

while(!pViewer->done() && !masterKilled )
>          {
>              pViewer->advance();
>              pViewer->eventTraversal();
>              pViewer->updateTraversal();
>
>              actionBetweenFrames(contextID); //just update some node in the
> scene graph (switch add and remove child)
>              pViewer->renderingTraversals();
>           }
>

But when I put the camera behind a node, the camera is shaking in the axis
translation (not allong Z axis when node is moving in XY plane)... It looks
something must un-synchronized...

Any idea ?

thanks.

Regards,

Vincent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080709/ffbf9e4c/attachment-0002.htm>


More information about the osg-users mailing list