Hi there, Firstly thanks for useful replies. I know, this programmatic operation is clumsy but I don't know any way to reorganize my 3d model structure. So I am trying to handle my model's components and then I will write the created scene in osg format. Then I can traverse the scene easily.
I succeed placing the components on the right place by using InverseMatrix like below, ------------------------------------------------------------------------------------------------------------------------------ osg::ref_ptr<osg::MatrixTransform> planetaryTransformNode1=dynamic_cast<osg::MatrixTransform*>(planetarynode->getChild(0)); osg::ref_ptr<osg::MatrixTransform> planetaryTransformNode2=dynamic_cast<osg::MatrixTransform*>(planetaryTransformNode1->getChild(0)); osg::Matrixd mm1=planetaryTransformNode1->getInverseMatrix(); osg::Matrixd mm2=planetaryTransformNode2->getInverseMatrix(); osg::ref_ptr<osg::MatrixTransform> additionalMT = new osg::MatrixTransform(mm1 * mm2); additionalMT->addChild(yawnode.get()); planetaryTransformNode2->addChild(additionalMT.get()); ------------------------------------------------------------------------------------------------------------------------------ When I perform this way to the additive node's Matrix Trasform, it can place right position on the screen. In right there, I have some question about defining center to the newly created MatrixTrasform node. Because when I try to rotate the yawnode around the Zup axes, it is rotating around the vec3(0.0,0.0;0.0) pivot point. If I use a PositionAttitudeTrasform, I can define new pivot point easly but what about MatrixTransform pivot point definitoin? And how can I get the GEODE nodes world coordinate matrix to defining pivot point for the MatrixTransform node? Another question is, As you see from the structure of models, There is a 2 Matrix Transform ("3DSPIVOTPOINT: Rotate" and "3DSPIVOTPOINT: Translate pivotpoint to (world) origin"). My planned structure, I will add one MatrixTrasform for every node. Is it comes with unexpected error or defectiveness in the future? Thanks to everyone :) Best Regards. Umit UZUN 2008/7/24 David Spilling <[EMAIL PROTECTED]>: > If I understand your problem correctly, the general approach would be to > compute the coordinate system matrix local to a group prior to a move (with > computeWorldToLocal) - call it A - then to move the node, recompute the > coordinate system in the new location - call this B - and apply the correct > matrix - i.e. inverse(B) * A - to the immediate parent transform to get the > correct positioning. In this way, when moving the object around in the > scenegraph, it won't move in the world frame. > > In this case, the yaw group doesn't have a parent transform, so the initial > matrix is the identity. The destination matrix will be the transform of > planetary's MatrixTransform node, so you will need to apply the inverse of > this matrix to your yaw specific MatrixTransform. > > I can't help but think that you must be able to persuade your 3DS model to > be in a much more useful structure - all this programmatic model hacking > (although useful for understanding OSG) seems quite clumsy... > > Regards, > > David > > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org