Time for action — adding animation
Our model can move but it isn't animated yet, let's change this.
- The
FrameListener
needs two animation states:Ogre::AnimationState* _aniState; Ogre::AnimationState* _aniStateTop;
- 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)
- 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);
- Now that we have the
AnimationState
, we need to have a flag in theframeStarted
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.