createScene()
function once again.Ogre::Entity* ent = mSceneMgr->createEntity("MyEntity","Sinbad.mesh"); Ogre::SceneNode* node = mSceneMgr->createSceneNode("Node1"); node->setPosition(0,0,400); node->yaw(Ogre::Degree(180.0f)); mSceneMgr->getRootSceneNode()->addChild(node); node->attachObject(ent);
Ogre::Entity* ent2 = mSceneMgr->createEntity("MyEntity2","Sinbad.mesh"); Ogre::SceneNode* node2 = node->createChildSceneNode("node2"); node2->yaw(Ogre::Degree(45)); node2->translate(0,0,20); node2->attachObject(ent2);
Ogre::Entity* ent3 = mSceneMgr->createEntity("MyEntity3","Sinbad.mesh"); Ogre::SceneNode* node3 = node->createChildSceneNode("node3"); node3->yaw(Ogre::Degree(45)); node3->translate(0,0,20,Ogre::Node::TS_LOCAL); node3->attachObject(ent3);
We created our reference model and then added two models which were rotated 45 degrees around the y-axis. Then we translated both with (0,0,20), one model in parent space, the default setting, and the other model in local space. The model we translated in parent space moved in a straight line on the z-axis. But because we rotated the models around the y-axis, the model we translated in local space moved with this rotation and ended up moving up and left in the image. Let's repeat this. When we translate, the default setting is parent space, meaning that all rotations, except the rotation of the scene node we translate, are used while translating. When using world space, no rotation is taken into consideration. When translating, the world coordination system is used. When translating in local space, every rotation, even the rotation from the node we translate, is used for the translation.
18.216.143.65