osg::AnimationPath osg::AnimationPath::ControlPoint osg::AnimationPathCallback

  • 使用
        osg::AnimationPath *  animationPath  =   new  osg::AnimationPath;
        
    // 设置循环,还可设成摇摆:SWING 或仅动作1次:NO_LOOPING 
        animationPath -> setLoopMode(osg::AnimationPath::LOOP);
        
    // 插入时间,和对应的位置和角度
        animationPath -> insert(time,osg::AnimationPath::ControlPoint(position,rotation));
        
    // 设置回调,第二个参数是延迟时间,第三个参数是和时间相乘,可加快和减缓速度
        xform -> setUpdateCallback( new  osg::AnimationPathCallback(animationPath, 0.0 , 1.0 ));
     
  • osg::AnimationPathCallback用法(Examples osgclip)
    osg::AnimationPathCallback::AnimationPathCallback  (  const  osg::Vec3d  &   pivot,  
      
    const  osg::Vec3d  &   axis,  
      
    float   angularVelocity   
     ) 
    含义:以privot为中心点,axis为轴,角速度是angularVelocity,一下为例子:
    osg::MatrixTransform *  transform =   new  osg::MatrixTransform;
    osg::NodeCallback
    *  nc  =   new  osg::AnimationPathCallback(subgraph -> getBound().center(),osg::Vec3( 0.0f , 0.0f , 1.0f ),osg::inDegrees( 45.0f ));
    transform
    -> setUpdateCallback(nc);
    transform
    -> addChild(clipnode);

你可能感兴趣的:(swing,insert,float,PIVOT)