Time for action — translating in local and parent space

  1. Clear the createScene() function once again.
  2. Insert a reference model; this time we will move it nearer to our camera so we don't have to move the camera so much:
    Ogre::Entity* ent = mSceneMgr->createEntity("MyEntity","Sinbad.mesh");
    Ogre::SceneNode* node = mSceneMgr->createSceneNode("Node1");
    node->setPosition(0,0,400);
    node->yaw(Ogre::Degree(180.0f));
    mSceneMgr->getRootSceneNode()->addChild(node);
    node->attachObject(ent);
    
  3. Add a second model and rotate it by 45 degrees around the y-axis and translate it (0,0,20) units in parent space:
    Ogre::Entity* ent2 = mSceneMgr->createEntity("MyEntity2","Sinbad.mesh"); Ogre::SceneNode* node2 = node->createChildSceneNode("node2"); node2->yaw(Ogre::Degree(45)); ...

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.