[osg-users] Effecting MatrixTransform matrix change

OpenSceneGraph Users osg-users at lists.openscenegraph.org
Mon Jun 1 04:24:12 PDT 2020


On Thu, May 28, 2020 at 10:11 AM OpenSceneGraph Users <
osg-users at lists.openscenegraph.org> wrote:

> Hello everyone! This must be a simple one... I have a node that has one
> parent which is a MatrixTransform. I simply need to move the child node to
> a specific location that is computed at run time. I figured I just needed
> to do the following, but this caused no change in the location of the node:
>
> const osg::Matrix OriginalParentMatrix =
> pParentMatrixTransform->getMatrix();
>
> osg::Matrix TranslateContribution;
> TranslateContribution.makeTranslate(10.0f, 0.0f, 0.0f);
>
> const osg::Matrix FinalNewMatrix = (OriginalParentMatrix *
> TranslateContribution);
>
> pParentMatrixTransform->setMatrix(FinalNewMatrix);
>
> No matter what translation I set in makeTranslate(), the child node
> doesn't move. Is there some call I'm missing to cause the new matrix to
> take effect on the node's parent matrix transform? Thank you in advance!
>
> Make sure that the data variance of the transform is dynamic after you
initially create it:
pParentMatrixTransform->setDataVariance(osg::Object::DYNAMIC);

Tim

> --
> You received this message because you are subscribed to the Google Groups
> "OpenSceneGraph Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to osg-users+unsubscribe at googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/osg-users/26bd1277-4323-4140-a080-a474b9273dc5%40googlegroups.com
> <https://groups.google.com/d/msgid/osg-users/26bd1277-4323-4140-a080-a474b9273dc5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200601/86d9316e/attachment.html>


More information about the osg-users mailing list