[osg-users] Updating a PositionAttitudeTransform node from another PositionAttitudeTransform node
Voerman, L.
l.voerman at rug.nl
Wed Oct 9 04:16:00 PDT 2019
Hi Dan,
I think your expectations are off. pose2 gets the postition from the node2
matrix, not the world postition.
to retrieve the world position you need to have a nodepath, so you can
call osg::computeLocalToWorld( fullNodePath );
In your case this might be just the product for the node1 matix and node2
matrix.
Laurens.
On Wed, Oct 9, 2019 at 10:26 AM Dan johansson <johansson_dan at hotmail.com>
wrote:
> 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
>
>
>
>
>
> _______________________________________________
> 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/20191009/70857aab/attachment.html>
More information about the osg-users
mailing list