Being able to constrain the camera so that it rotates about an object is very useful and saves time when you wish to view or manipulate the object from various perspectives. Orbiting is a technique in which the user drags the mouse to move the camera at a fixed distance about a point, while keeping the camera focused on the point. In this recipe, we'll show you how to implement tools for orbiting and for constraining the orbit to a single axis.
To follow this recipe, open the solution located in the Recipes/Chapter09
folder in the code bundle available on the Packt website.
1. First, create a new Ogre MFC Ribbon application named
OrbitView
by following the Creating an MFC Ogre application with a Ribbon recipe from Chapter 1.2. In
COrbitViewView::EngineSetup()
, create a robot entity, add it to the scene, and make the camera look at the center of the robot.Ogre::Entity *RobotEntity = m_SceneManager-> createEntity("Robot", "robot.mesh");...