[osg-users] Updating a PositionAttitudeTransform node from another PositionAttitudeTransform node

Dan johansson johansson_dan at hotmail.com
Wed Oct 9 01:27:04 PDT 2019


Hi,

I've ran into a seemingly easy problem that i have failed to find an answer for. I've simplified the problem here to quickly describe my question. I'm setting a Pat node as parent to another Pat node and re positioning it. The updated position is not translated to the child and i wonder why this behavior occurs. Any help on the issue is welcome.






Code:


osg::ref_ptr<osg::PositionAttitudeTransform> node1 = new osg::PositionAttitudeTransform;
osg::ref_ptr<osg::PositionAttitudeTransform> node2 = new osg::PositionAttitudeTransform;

node1->setDataVariance(osg::Object::DYNAMIC);
node2->setDataVariance(osg::Object::DYNAMIC);

node1->setPosition((osg::Vec3f(0.f,0.f,0.f)));
node2->setPosition((osg::Vec3f(0.f,0.f,0.f)));

node1->addChild(node2.get());
node1->setPosition(osg::Vec3f(10.f,10.f,10.f));

osg::Vec3f pose2 = node2->getPosition();

//pose2 is still at (0,0,0)






//Regards Dan

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76810#76810







More information about the osg-users mailing list