OSG: полет камеры с помощью AnimationPathManipulator

Я пытаюсь применить osg :: AnimationPath к камере моего экземпляра osgViewer :: Viewer с помощью osgGA :: AnimationPathManipulator. Моя проблема в том, что AnimationPathManipulator применяет только изменение поворота, а не изменение положения камеры. Так что он только вращается, но не переводится.

Я использую библиотеку OpenSceneGraph 3.0.1.

Для лучшего понимания, это мой текущий код:

void CameraFlyTest::animateCamera(osgViewer::Viewer* viewer) {

osg::AnimationPath* path = new osg::AnimationPath();
path->setLoopMode(osg::AnimationPath::SWING);

osg::AnimationPath::ControlPoint cp1;
cp1.setPosition(osg::Vec3d(-200,-450,60));
cp1.setRotation(osg::Quat(M_PI_2, osg::Vec3(1,0,0)));

osg::AnimationPath::ControlPoint cp2;
cp2.setPosition(osg::Vec3d(2000,-500,60));
cp2.setRotation(osg::Quat(M_PI_4, osg::Vec3(1,0,0)));

path->insert(1.0f,cp1);
path->insert(3.0f,cp2);

osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(path);
viewer->setCameraManipulator(apm);
}

1

Решение

Проблема заключалась в том, что другой активный манипулятор камеры также обновил положение камеры. Сам osgGA :: AnimationPathManipulator работает как надо.

2

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector