[osg-users] How to get Node object from PositionAttitudeTransform object

Robert Osfield robert.osfield at gmail.com
Sat Apr 15 01:22:25 PDT 2017


Hi Duc,

You appear a bit confused as to what dynamic_cast does so I'd
recommend looking C++ resources online on the subject, there's such a
wealth of information on C++ usage online it's best place to go for
guidance rather have us try to do the same here.

On the OSG side, to get a child of a group (include a child of
PositionAttitudeTransform), so in you case you simple go :

    Node* child = pt->getChild(i); // i is the index number of the
child, 0 for the first

Robert.



On 15 April 2017 at 04:05, duc nguyen <osgforum at tevs.eu> wrote:
> Hi,
>
> I use PositionAttitudeTransform object  to store and set position for my Node object. Like that:
>
> Code:
> osg::ref_ptr< osg::PositionAttitudeTransform> pt = new osg::PositionAttitudeTransform;
> pt->setPosition( osg::Vec3( Vertex[0], Vertex[1], Vertex[2] ) );
> pt->addChild(myNode);
>
>
>
> It OK. But after that i can't get my Node from that PositionAttitudeTransform. I try to use dynamic_cast but not success:
>
> Code:
> osg::Node* myNode = dynamic_cast<osg::Node*>(pt);
>
>
> // it return PositionAttitudeTransform type for MyNode, then MyNode become PositionAttitudeTransform object, I want it return Node Object
>
> Please help me how can i get Node from PositionAttitudeTransform object
>
> ...
>
> Thank you!
>
> Cheers,
> duc
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=70763#70763
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



More information about the osg-users mailing list