|
osg2.99 版本中"euler"运动怎么实现?2.99版本examples中的osganimationsolid程序中有平移和旋转的代码(绿色部分),但编译出来的exe中只有平移功能,没有旋转功能。
以下是osganimationsolid.cpp中的部分程序代码:
osg::ref_ptr<osg::MatrixTransform> trans = new osg::MatrixTransform();
trans->setName("AnimatedNode");
trans->setDataVariance(osg::Object:YNAMIC);
osgAnimation::UpdateMatrixTransform* updatecb = new osgAnimation::UpdateMatrixTransform("AnimatedCallback");
updatecb->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("position"));
trans->setUpdateCallback(updatecb);
trans->setMatrix(osg::Matrix::identity());
trans->addChild (geode.get());
root->addChild (axe.get());
root->addChild (trans.get());
// Define a scheduler for our animations
osg::Group* grp = new osg::Group;
osgAnimation::BasicAnimationManager* mng = new osgAnimation::BasicAnimationManager();
grp->setUpdateCallback(mng);
grp->addChild(root);
// And we finaly define our channel
osgAnimation::Vec3LinearChannel* channelAnimation1 = new osgAnimation::Vec3LinearChannel;
channelAnimation1->setTargetName("AnimatedCallback");
channelAnimation1->setName("position");
channelAnimation1->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(0, osg::Vec3(0,0,0)));
channelAnimation1->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(2, osg::Vec3(1,1,0)));
osgAnimation::Animation* anim1 = new osgAnimation::Animation;
anim1->addChannel(channelAnimation1);
anim1->setPlayMode(osgAnimation::Animation:PONG);
osgAnimation::Vec3LinearChannel* channelAnimation2 = new osgAnimation::Vec3LinearChannel;
channelAnimation2->setTargetName("AnimatedCallback");
channelAnimation2->setName("euler");
channelAnimation2->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(0, osg::Vec3(0,0,0)));
channelAnimation2->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(1.5, osg::Vec3(2*osg::PI,0,0)));
osgAnimation::Animation* anim2 = new osgAnimation::Animation;
anim2->addChannel(channelAnimation2);
求助!osg2.99中怎么实现旋转功能?
anim2->setPlayMode(osgAnimation::Animation:OOP); |
|