Time for action — creating a scene node with Ogre 3D

We are going to use the code from Chapter 1, Installing Ogre 3D modify it to create a new scene node, and attach it to the scene. We will follow these steps:

  1. In the old version of our code, we had the following two lines in the createScene() function:
    Ogre::Entity* ent = mSceneMgr->createEntity("MyEntity","Sinbad.mesh");
    mSceneMgr->getRootSceneNode()->attachObject(ent);
    
  2. Replace the last line with the following:
    Ogre::SceneNode* node = mSceneMgr->createSceneNode("Node1");
    
  3. Then add the following two lines; the order of those two lines is irrelevant for the resulting scene:
    mSceneMgr->getRootSceneNode()->addChild(node);
    node->attachObject(ent);
    
  4. Compile and start the application.
  5. You should see the ...

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.