Time for action — rotating in different spaces
This time, we are going to rotate using different spaces, as follows:
- And again, we will start with a clean
createScene()
function, so delete all code inside this function. - Add the reference model:
Ogre::Entity* ent = mSceneMgr->createEntity("MyEntity","sinbad.mesh"); Ogre::SceneNode* node = mSceneMgr->createSceneNode("Node1"); mSceneMgr->getRootSceneNode()->addChild(node); node->attachObject(ent);
- Add a second model and rotate it the normal way:
Ogre::Entity* ent2 = mSceneMgr->createEntity("MyEntity2","sinbad.mesh"); Ogre::SceneNode* node2 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node2"); node2->setPosition(10,0,0); node2->yaw(Ogre::Degree(90)); node2->roll(Ogre::Degree(90)); node2->attachObject(ent2); ...
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.