This time, we are going to use another model besides Sinbad: the ninja.
Remove all the code from the
createScene()
function.Create Sinbad like we always do:
Ogre::Entity* ent = mSceneMgr->createEntity("MyEntity","Sinbad.mesh"); Ogre::SceneNode* node = mSceneMgr->createSceneNode("Node1"); node->setPosition(10,10,0); mSceneMgr->getRootSceneNode()->addChild(node); node->attachObject(ent);
Now create a ninja, which will follow Sinbad everywhere he goes:
Ogre::Entity* ent2 = mSceneMgr->createEntity("MyEntitysNinja","ninja.mesh"); Ogre::SceneNode* node2 = node->createChildSceneNode("node2"); node2->setPosition(10,0,0); node2->setScale(0.02f,0.02f,0.02f); node2->attachObject(ent2);
Compile and run the application. When you take a closer look at Sinbad, you will see a green ninja at his left arm.
Now change the position to (40,10,0):
node->setPosition(40,10,0);
And rotate the model 180 degree around the x-axis...