Time for action — adding movement to the scene

Up until now, we only had one class, namely, ExampleApplication. This time we need another one:

  1. Create a new class, name it Example25FrameListener, and let it inherit publicly from Ogre::FrameListener:
    class Example25FrameListener : public Ogre::FrameListener
    {
    };
    
  2. Add a private member variable, which is an Ogre::SceneNode pointer, and name it _node:
    private:
    Ogre::SceneNode* _node;
    
  3. Add a public constructor that takes an Ogre::SceneNode pointer as a parameter and assigns it to the member node pointer:
    public:
    Example25FrameListener(Ogre::SceneNode* node)
    {
    _node = node;
    }
    
  4. Add a new function called frameStarted(FrameEvent & evt), which translates the member node with (0,0,0.1) and then returns true:
    bool ...

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.