|
这是《OSG编程入门指南》中关于MatrixTransform例子的代码节选:-
- osg::Node* node = new osg::Node();
- node = osgDB::readNodeFile("cow.osg");
- osg::MatrixTransform* mt1 = new osg::MatrixTransform() ;
- osg::Matrix m;
- //在X方向平移10个单位
- m.makeTranslate(osg::Vec3(10.0f,0.0f,0.0f));//语句一
- m.makeRotate(45.0f,1.0f,0.0f,0.0f);//语句二
- mt1->setMatrix(m);
- mt1->addChild(node);
- //创建矩阵变换节点mt2
- osg::MatrixTransform* mt2 = new osg::MatrixTransform();
- osg::Matrix t ;
- t.makeTranslate(osg::Vec3(-10.0f,0.0f,0.0f));
- mt2->setMatrix(t);
- mt2->addChild(node);
复制代码 问题:在语句一处,我把10.0f改成任意数值,结果都是只执行了mt2 的平移-10。似乎语句一不执行。如果跟后面的旋转45度的语句二对调,则只执行平移,而就不执行旋转了。怎么会这样,如何解决。谢谢。 |
|