Time for action — adding animation

Our model can move but it isn't animated yet, let's change this.

  1. The FrameListener needs two animation states:
    Ogre::AnimationState* _aniState;
    Ogre::AnimationState* _aniStateTop;
    
  2. To get the animation states in the constructor, we need a pointer to the entity:
    MyFrameListener(Ogre::RenderWindow* win,Ogre::Camera* cam,Ogre::Viewport* viewport,Ogre::SceneNode* node,Ogre::Entity* ent)
    
  3. With this pointer we can retrieve the AnimationState and save them for later use:
    _aniState = ent->getAnimationState("RunBase");
    _aniState->setLoop(false);
    _aniStateTop = ent->getAnimationState(«RunTop»);
    _aniStateTop->setLoop(false);
    
  4. Now that we have the AnimationState, we need to have a flag in the frameStarted function, which tells ...

Get Ogre 3D 1.7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.