|
楼主 |
发表于 2008-3-19 16:26:34
|
显示全部楼层
实现了,在物体节点上加一个更新回调就可以
osg:: PositionAttitudeTransform* xform = new osg:: PositionAttitudeTransform;
osg::AnimationPath* animationPath = createAnimationPath(path);
xform->setUpdateCallback(new osg::AnimationPathCallback(animationPath,0.0,1.0));
xform->addChild(object);
其中createAnimationPath定义如下:
createAnimationPath(std::string& path)
{
std::ifstream in(path.c_str());
osg::AnimationPath* amp = new osg::AnimationPath;
amp->read(in);
in.close();
return amp;
}
还是蛮简单的,谢谢版主!
[ 本帖最后由 npu_feiyi 于 2008-3-19 16:29 编辑 ] |
|