CreateFlyStraightAnimator

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
grantkrieger
Posts: 25
Joined: Fri Jul 27, 2007 10:02 am

CreateFlyStraightAnimator

Post by grantkrieger »

Hello,

I am wanting to move the camera from point 1 to point 2 slowly. When I get to point I would like to change the target of the camera or do some else. The problem I am having with CreateFlyStraightAnimator is that it seems to be executed in its own thread or something as any statement I put after it appears to be executed first. So I am unable to do anything after using the CreateFlyStraightAnimator as its done before.

Example c#

FlyStraight = smgr.CreateFlyStraightAnimator(CameraStartPos, GoToNode.Position ,1000, false);
camera.AddAnimator(FlyStraight);
camera.RemoveAnimator(FlyStraight);

In the above example the fly straight does not even happen as its removed by RemoveAnimator.Surely fly straight should happen move the camera then remove should happen afterwards

Please help

Thanks

Grant
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

What you're talking about would requite addAnimator to block execution until the animator had finished. This obviously isn't very feasible as you need to be rendering and carrying out other tasks at the same time as the animator moving the camera.

What happens is you add the animator and then device->run() carries out per frame movements according to the animator. So what you need to do is add the animator and then listen out for when the animator has finished.

One way you could do this is in your device->run() loop you could check to see if the camera's position has changed since the last frame. If it has then the camera is still being moved by the animator. If it hasn't then you know the animator has finished and you can then queue up whatever other camera changes you want to make like setting its target etc.
Image Image Image
Post Reply