I wanted to play around a little bit with the camera scenenode and came across a very strange behaviour.
When you look nearly straight up (let's say 85°) and then look straight up, then the camera rolls at 90°. If you then look again nearly straight up, but with let's say 95°, then the camera rolls again at 90° and is, compared with the start situation, flipped.
The code at the end of this post should demonstrate the problem.
I don't know wether it's a bug or if I just do something wrong (although I can't see what).
Thanks in advance,
-Lu
Code: Select all
#include "irrlicht.h"
using namespace irr;
int main()
{
//setup irrlicht
IrrlichtDevice* device = createDevice(video::EDT_OPENGL,core::dimension2du(800,600));
scene::ISceneManager* smgr = device->getSceneManager();
video::IVideoDriver* driver = device->getVideoDriver();
//make a moving cube
scene::ISceneNode* node = smgr->addCubeSceneNode(5,0,-1,core::vector3df(0,100,50));
scene::ISceneNodeAnimator* anim = smgr->createFlyStraightAnimator(core::vector3df(0,100,50),core::vector3df(0,100,-50),5000,true,true);
node->addAnimator( anim );
anim->drop();
//add nodes for orientation
smgr->addCubeSceneNode(10,0,-1,core::vector3df(50,100,0));
smgr->addBillboardTextSceneNode(device->getGUIEnvironment()->getBuiltInFont(),L"Start",0,core::dimension2df(20,20),core::vector3df(0,100,60));
smgr->addBillboardTextSceneNode(device->getGUIEnvironment()->getBuiltInFont(),L"Goal",0,core::dimension2df(20,20),core::vector3df(0,100,-60));
//add camera
scene::ICameraSceneNode* camera = smgr->addCameraSceneNode();
while( device->run() )
{
//let camera follow the cube
camera->setTarget( node->getPosition() );
//draw scene
driver->beginScene(true,true,video::SColor(255,255,0,0));
smgr->drawAll();
driver->endScene();
}
return 0;
}