How change MoveSpeed for CameraFPS?

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
Morganolla
Posts: 44
Joined: Tue Nov 17, 2009 9:56 am
Location: Rus

How change MoveSpeed for CameraFPS?

Post by Morganolla »

Hi, guys... I created camera :
scene::ICameraSceneNode* pCam=smgr->addCameraSceneNodeFPS(0,100,MoVel);
How can I change move speed my camera during the game???
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

Post by pc0de »

One way is to extract the FPS animator:

Code: Select all

ISceneNodeAnimatorCameraFPS* fpsAnimator=0;

scene::ICameraSceneNode* pCam=smgr->addCameraSceneNodeFPS(0,100,MoVel); 

// save off animator
core::list<ISceneNodeAnimator*>::ConstIterator anims=pCam->getAnimators().begin();
while(anims != pCam->getAnimators().end())
{
    if ((*anims)->getType() == ESNAT_CAMERA_FPS)
    {
        fpsAnimator = (ISceneNodeAnimatorCameraFPS*)*anims;
        break;
    }
}
and then whenever you want to adjust the speed:

Code: Select all

 if(fpsAnimator)
    fpsAnimator->setMoveSpeed(MoVel * 2.f);  // double the current speed
Last edited by pc0de on Thu Dec 31, 2009 5:34 am, edited 1 time in total.
Morganolla
Posts: 44
Joined: Tue Nov 17, 2009 9:56 am
Location: Rus

Post by Morganolla »

Thank you very much!!! I didn"t think that it is so difficult, sorry..:)
Post Reply