Time for action — setting the position of a scene node

  1. Add this new line after the creation of the scene node:
    node->setPosition(10,0,0);
    
  2. To create a second entity, add this line at the end of the createScene() function:
    Ogre::Entity* ent2 = mSceneMgr->createEntity("MyEntity2","Sinbad.mesh");
    
  3. Then create a second scene node:
    Ogre::SceneNode* node2 = mSceneMgr->createSceneNode("Node2");
    
  4. Add the second node to the first one:
    node->addChild(node2);
    
  5. Set the position of the second node:
    node2->setPosition(0,10,20);
    
  6. Attach the second entity to the second node:
    node2->attachObject(ent2);
    
  7. Compile the program and you should see two instances of Sinbad:
    Time for action — setting the position of a scene node

What just ...

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.