[osg-users] osgManipulator strange behavior

Vincent Bourdier vincent.bourdier at gmail.com
Wed Mar 4 09:22:16 PST 2009

Hi all,

Using osgManipulator, I use 2 draggers (translation and rotation) to
move/rotate an element in the scene.

Everything is fine when I dragg using the draggers... BUT (of course) when I
decide to move the dragger without mouse action, things become difficult.

My dragger are like that :

           |                                    |
Translate dragger         Translate Selection
           |                                    |
Rotate Dragger            Rotate Selection

The Selection are osgManipulator::Selection elements (matrix)

I get a move vector, and a rotate vector (3 angles).
I set the matrices of the Selection with the move vector (the translate
selection matrix, and the Translate dragger matrix to put the dragger
graphical representation at the same place)
Same thing for the rotation... I set the matrices with a good (verified)
matrix or rotation.

But, there is problem : even if my rotation matrix is identity, the geode
and the rotate dragger rotate a little (or more depending on original
rotation) ??!!

I use this code (for test):
> RotateSelection->setMatrix(osg::Matrix::identity() /*rot*/);
> TranslateSelection->setMatrix(osg::Matrixd::translate(position));
> float scale =
> getPlaneGizmo()->getBound().radius()*getPlaneGizmo()->getWorldMatrices()[0].getScale()[0]
> * 1.2;//dragger size
> //move the translation dragger
> _TranslateDragger->setMatrix(osg::Matrix::scale(scale*2.0, scale*2.0,
> scale*2.0) *
> osg::Matrix::translate(getPlaneGizmo()->getBound().center()*getPlaneGizmo()->getWorldMatrices()[0]));
> //move dragger
> //rotate the rotation drager
> _RotateDragger->setMatrix(osg::Matrix::scale(scale, scale, scale) /**
> rot*/); //rotate dragger

No rotations ... but rotation on the result...

Maybe there is something I don't understand in the Dragger/Manipulator
elements ?

Any idea or suggestion would be very nice for me :-)


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

More information about the osg-users mailing list