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 — 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 ...

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