Effecting MatrixTransform matrix change

15 views
Skip to first unread message

Erik Hensens

unread,
May 27, 2020, 9:22:50 AM5/27/20
to OpenSceneGraph Users
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!

OpenSceneGraph Users

unread,
May 27, 2020, 10:55:16 AM5/27/20
to osg-...@lists.openscenegraph.org
Do you have any other objects in the scene? Could it be that the point
of view is moving with the object?

--
Alberto

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

Erik Hensens

unread,
May 27, 2020, 3:00:32 PM5/27/20
to OpenSceneGraph Users
Hi Alberto. There are lots of other objects in the scene, but the point of view is not moving as this is happening.

OpenSceneGraph Users

unread,
Jun 1, 2020, 7:24:38 AM6/1/20
to OpenSceneGraph Users
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+...@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.
Reply all
Reply to author
Forward
0 new messages