I started to write the AI code for my FPS,and I started from writing a function that makes a node follow the camera :
Code: Select all
void follow(scene::IAnimatedMeshSceneNode * enemy,scene::ISceneManager* smgr,scene::ISceneNode * camera)
{
core::vector3df enemystart = enemy->getPosition();
irr::scene::ISceneNodeAnimator* anim = smgr->createFlyStraightAnimator (enemystart,
core::vector3df(camera->getPosition().X,camera->getPosition().Y,camera->getPosition().Z), ENEMY_FOLLOWSPEED, false ) ;
enemy->addAnimator(anim);
}
I thought that if a node is already affected by gravity, the FlyStraight animator would only make the node move in the given direction , but following the floor and the stairs , and not on a straight line.
Is there a way to make two or more animators coexist in the same node , or there's something wrong in the code ?
Should I use something else than the FlyStraight animator ?
Thanx in advance