[osg-users] Fwd: Fwd: Fwd: CallBack issue
dosto.walla at gmail.com
Sat Mar 28 05:55:50 PDT 2009
So you mean that the setMatrix() function after the callback is not making
any difference to the scene.
But i get different scene when i toggle the matrix setup after the callback.
With setMatrix() after the callback i get two cows side by side and the left
one is rotating around z
Without setMatrix() after the callback i still do get two cows side by side
and the left one is rotating around z by the left ones head is cut by the
---------- Forwarded message ----------
From: Ulrich Hertlein <u.hertlein at sandbox.de>
Date: Sat, Mar 28, 2009 at 12:26 PM
Subject: Re: [osg-users] Fwd: Fwd: CallBack issue
To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org>
On 28/3/09 10:00 PM, ami guru wrote:
> The following snippet may elaborate more:
> mtLeft->setUpdateCallback(new RotateCB);
> osg::Matrix m;
> On the above snippet we have made a translation after the callback. And
> that one is appended to the one that has been called inside the RotateCB.
First of all, the fact that you set a translation matrix is irrelevant. The
callback (as you have posted in a previous mail) will always overwrite
whatever matrix you set during setup.
I understand the point you're trying to make. What I'm saying is that when
you use MatrixTransform->setMatrix(m) you're loosing anything that has been
set before. If you want to preserve that (i.e. the translation in your
example) you have to take care of that yourself.
>From what I grok you're looking for a way to keep the translation part and
only change the rotation. You could try to do something like:
Matrix m = mt->getMatrix();
Or use decompose(), change the rotation and re-assemble the matrix: scaling,
rotation, transform and all.
Or pass the translation to the update callback so that it can assemble and
set the proper transformation matrix. Or split the translation and the
rotation into different MatrixTransforms.
Many roads lead to Rome.
matrixTransform->setMatrix(Matrix::makeRotate(...)) is not one of them. ;-)
Hope this helps,
osg-users mailing list
osg-users at lists.openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the osg-users