Problems with 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
Frazz1080
Posts: 41
Joined: Fri Nov 18, 2005 3:09 am

Problems with createFlyStraightAnimator

Post by Frazz1080 »

Back to working on smoothing out motion, I think I'm much closer than before, but my application crashes... :(
I have my keypress event in the Render loop, and it seems to work better now since I moved it from the main() loop. My only problem is I can't seem to implement it into my KeyBoard Event Receiver Class(Keless's tutorial).
My code so far is basically the same thing as last:

scene::ISceneNodeAnimator* flyto = 0;
scene::ISceneManager* smgr; //activates Scene Manager

*Keyboard event Receiver*
switch(event.KeyInput.Key)
{
case KEY_KEY_A:
{
irr::u32 Time = device->getTimer()->getTime();
vector3df moveForward = Arwing->getAbsolutePosition();
moveForward.X += 2.0f;
flyto = smgr->createFlyStraightAnimator(
Arwing->getAbsolutePosition(), moveForward, 4000, false);
Arwing->addAnimator(flyto);
flyto->drop();
break; }

When I use just the plain keypress code in the Render loop, it works just the way I want it, minus the loop I'd like to have in the Event Receiver. I've also tried removing flyto = smgr...(false); code from it, but this crashes the game. And then I have even tried removing the entire chunk of code(event receiver) for Key A, but that does the same thing.
I'm lost for this one, although I'm following the Elevator movement code from Mike R's question.
What's causing it to crash?
r3i
Posts: 147
Joined: Wed Jun 29, 2005 10:15 am
Location: Sorrento
Contact:

Post by r3i »

UHm...try to remove animators before move your node.
Try to make:
case KEY_KEY_A:
arwin->removeAnimators();
... // do things

I've tried flySthraightAnim on a camera and it'doesnt move if I don't remove the animator after it played.
Maybe it is
"We work in the dark, we do what we can, we give what we have, Our doubt is our passion and our passion is our task. The rest: is art of Madness" (H.James)
Post Reply