Page 1 of 1

stopping FlyStraightAnimator

Posted: Tue Jul 11, 2006 3:32 pm
by irrlicher
Hi everybody i've a question in my game i want to stop the FlyStraightAnimator when my class's health is less than 0.
I tried many things but it didn't respond.How can i stop it when my health is less than 0??
That's my code but it didn't work:

Code: Select all

if (health<0)
{
anim = smgr->createFlyStraightAnimator(pos,core::vector3df(16000,350,18000), 0, false);
}
anim = smgr->createFlyStraightAnimator(pos,core::vector3df(16000,350,18000), 10000, false);
node->addAnimator(animaml);
anim->drop();
Note:"pos" is node's position;
Thanks in advance!

Posted: Tue Jul 11, 2006 3:35 pm
by vitek
Adding a new animator does not help. Any existing animators need to be removed...

Code: Select all

  if (health < 0)
  {
    // if you have a pointer to the animator
    node->removeAnimator(fly);

    // if you don't have a pointer to it. note that this will remove all animators
    node->removeAnimators();
  }

Posted: Tue Jul 11, 2006 4:34 pm
by irrlicher
That worked now! :) Thanks a lot!!