Animating a camera

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
inbuninbu
Posts: 8
Joined: Mon Feb 05, 2007 12:12 am

Animating a camera

Post by inbuninbu »

Hi all,

After working with crystalspace/cel for a while, I've decided to try irrlicht. So far, the API seems a great deal more comprehensible and documented. And much more intuitive.

That being said, I am having problems animating the camera.

I create a cube and camera to start with...

Code: Select all

  ISceneManager* scenemgr = device->getSceneManager();
  ISceneNode* node = scenemgr->addCubeSceneNode ();
  ICameraSceneNode* camera = scenemgr->addCameraSceneNode(0, core::vector3df(0,-40,0), core::vector3df(0,0,0));
If I add a rotation animator to the cube, the cube rotates.

Code: Select all

ISceneNodeAnimator* anim = scenemgr->createRotationAnimator(vector3df(1,0,0));
node->addAnimator(anim);
But if I add it to the camera instead, nothing happens.

Code: Select all

ISceneNodeAnimator* anim = scenemgr->createRotationAnimator(vector3df(1,0,0));
camera->addAnimator(anim);
Any insights?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The camera looks at the lookAt vector which is not affected by rotation. So you can rotate the complete mesh your camera is connected with without rotating the view, or you can turn the camera without turning the complete mesh. Only if you want to lock the two things you have to add some code.
inbuninbu
Posts: 8
Joined: Mon Feb 05, 2007 12:12 am

Post by inbuninbu »

Thanks!
Post Reply