Sorry if I don't understand you again, but my program is giving you the 
absolute position of the node (the fourth column of the matrix, (10,20,-5)) 
and its world orientation ( the first 3x3 block, equal to identity since the 
two transforms were translation ones).

Try changing m1 and m2 to see the changes in the global position and 
orientation.

El Jueves 27 Marzo 2008ES 17:31:51 Vincent Bourdier escribió:
> In your example you are using getWorldMatrices.
> I know this function, thanks... I and Robert were talking about it.
> But what I simply need is :
>
> with a node, I need its position (absolute/world coordinates), and its
> orientation (in the world system coordinates).
> How can I do it ?
>
> (Sorry, I'm not very understandable...)
>
> Thanks,
>
> Regard.
>    Vincent.
>
> 2008/3/27, Alberto Luaces <[EMAIL PROTECTED]>:
> > Sorry, I don't get what you exactly are looking for. Would this example
> > help?
> > It calculates the position of a node in world coordinates:
> >
> > #include <osg/Node>
> > #include <osg/Group>
> > #include <osg/Matrix>
> > #include <osg/MatrixTransform>
> >
> > #include <iostream>
> >
> > int main()
> > {
> >         osg::Group *root;
> >         osg::Node *n;
> >         osg::MatrixTransform *m1, *m2;
> >
> >         root = new osg::Group;
> >         n = new osg::Node;
> >         m1 = new osg::MatrixTransform( osg::Matrix::translate(osg::Vec3
> > (0.0,10.0,0.0)));
> >         m2 = new osg::MatrixTransform( osg::Matrix::translate(osg::Vec3
> > (10.0,10.0,-5.0)));
> >
> > //      root->m1->m2->n
> >
> >         root->addChild(m1);
> >         m1->addChild(m2);
> >         m2->addChild(n);
> >
> >         osg::MatrixList ml = n->getWorldMatrices();
> >
> >         for(int i=0; i<4; i++)
> >         {
> >                 for(int j=0; j<4; j++)
> >                 {
> >                         std::cout << ml[0](j,i) << "\t";
> >                 }
> >         std::cout << "\n";
> >         }
> >
> >         return 0;
> > }
> >
> > El Jueves 27 Marzo 2008ES 16:24:47 Vincent Bourdier escribió:
> > > Hi Alberto
> > >
> > > Thanks for help, I understand the instance problem... If all is good in
> >
> > my
> >
> > > situation I would not have many instances of the same node... so I
> > > think
> >
> > it
> >
> > > will be more simple...
> > >
> > > Because my problem is more recent, I ask a second question : To get
> > > this node's position (absolute ), if I understand well I must use
> > > something
> >
> > like
> >
> >
> > http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/CameraC
> >on
> >
> > >trolFindingWorldCoordinates
> > >
> > > There is no other way ?
> > >
> > > Thanks,
> > >
> > >  Regards.
> > >     vincent.
> > >
> > > 2008/3/27, Alberto Luaces <[EMAIL PROTECTED]>:
> > > > El Jueves 27 Marzo 2008ES 15:24:48 Vincent Bourdier escribió:
> > > > > but if I want to get the world Matrix, the one which represent the
> > > >
> > > > node's
> > > >
> > > > > position and translation in absolute system, how can I do ? Which
> > > > > matrix
> > > >
> > > > I
> > > >
> > > > > have to get ?
> > > >
> > > > If you have several wold matrices, it means that you have
> > > > instantiated
> >
> > a
> >
> > > > node
> > > > several times. Only you know in what instance you are interested.
> >
> > Think
> >
> > > > about
> > > > the four wheels of a car, there are 4 instances of the same node, the
> > > > wheel
> > > > mesh.
> > > >



_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to