Time for action — adding a second animation

Here, we will use the same code that we used for creating the first example:

  1. Change the animation from Dance to RunBase.
    _aniState = _ent->getAnimationState("RunBase");
    
  2. Run and compile the application. You should see Sinbad running, but only with the lower half of his body.
    Time for action — adding a second animation
  3. For our second animation, we need a new pointer for the animation state:
    Ogre::AnimationState* _aniStateTop;
    
  4. Then, of course, we need to get an animation for this state, enable it, and loop it. The animation we want to get is called RunTop:
    _aniStateTop = _ent->getAnimationState("RunTop"); _aniStateTop->setEnabled(true); _aniStateTop->setLoop(true); ...

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.