Time for action — adding movement to the scene
Up until now, we only had one class, namely, ExampleApplication
. This time we need another one:
- Create a new class, name it
Example25FrameListener
, and let it inherit publicly fromOgre::FrameListener:
class Example25FrameListener : public Ogre::FrameListener { };
- Add a private member variable, which is an
Ogre::SceneNode
pointer, and name it_node:
private: Ogre::SceneNode* _node;
- 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; }
- Add a new function called
frameStarted(FrameEvent & evt)
, which translates the member node with (0,0,0.1) and then returnstrue:
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.