O'Reilly logo

Ogre 3D 1.7 by Felix Kerger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — making the camera work again

We have already created our camera; now we are going to use it in combination with user input as follows:

  1. Extend the constructor of the Framelistener to get a pointer to our camera:
    Example30FrameListener(Ogre::SceneNode* node,RenderWindow* win,Ogre::Camera* cam)
    
  2. Also add a member variable for storing the camera pointer:
    Ogre::Camera* _Cam;
    
  3. Then assign the parameter to the member:
    _Cam = cam;
    
  4. Modify the instantiation of the FrameListener to add the camera pointer:
    Ogre::FrameListener* FrameListener = new Example30FrameListener(_SinbadNode,mWindow,mCamera);
    
  5. To move the camera, we need to get mouse input. So create a new member variable for storing the mouse:
    OIS::Mouse* _mouse;
    
  6. In the constructor, init ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required