onFixedUpdate

Why ?

As the onUpdate function, this function is made to update values of GameObject.

When ?

The difference between onUpdate and this function, is when it is call. onFixedUpdate is call each fixedTime during the game. fixedTime is a variable set in KEngine and can be modify.

If you do not change the value of fixedTime, onFixedUpdate is called each 25ms.

You can change fixedTime by using this line of code :

KapEngine::KEngine engine; //here we create a new Game

KapEngine::Time::ETime newFixedTime; //here we create new Time variable
newFixedTime.setSeconds(1.f); //here we set time variable to 1 seconds

engine.setFixedTime(newFixedTime); //here we set the fixedTime to 1 second.
//this code means that all onFixedTime gonna be call each seconds.

Prototype

//hpp
void onFixedUpdate() override;
//cpp
void KapEngine::MyGame::MyComponent::onFixedUpdate() {
    //do what you want
}

Last updated