|
我想做条物体移动的过程,但不用osgAnimation,还是用以前的osg::AnimationPath,但是做了个小程序测试,始终不见东西,不知道哪块出问题了,各位同仁能帮忙看下吗?折腾好久了,烦
osgViewer::Viewer viewer;
osg::Group* group = new osg::Group;
osg::AnimationPath* animationPath_test = new osg::AnimationPath;;
animationPath_test->setLoopMode(osg::AnimationPath:OOP);
animationPath_test->insert( 0, osg::AnimationPath::ControlPoint(osg::Vec3(0.0, 0.0, 0.0), osg:uat(0.0,0.0,0.0,0.0)) );
animationPath_test->insert( 2, osg::AnimationPath::ControlPoint(osg::Vec3(2.0, 0.0, 0.0), osg::Quat(0.0,0.0,0.0,0.0)) );
animationPath_test->insert( 4, osg::AnimationPath::ControlPoint(osg::Vec3(4.0, 0.0, 0.0), osg::Quat(0.0,0.0,0.0,0.0)) );
osg::ShapeDrawable* shape_test = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0f, 0.0f, 0.0f), 2));
shape_test->setColor( osg::Vec4(1.0f, 1.0f, 0.0f, 1.0f) );
osg::Geode* geode_test = new osg::Geode();
geode_test->addDrawable( shape_test );
osg::MatrixTransform* xform_test = new osg::MatrixTransform;
xform_test->setUpdateCallback( new osg::AnimationPathCallback( animationPath_test ) );
xform_test->addChild ( geode_test );
group->addChild ( xform_test );
viewer.setSceneData( group );
return viewer.run(); |
|