CorPetit09
20-10-2010 11:24:53
Hi,
My problem is this, I have access to an object mesh (which I think is made through an Entity). The fact is that I load the scene from a .scene file and I don't know the names of each of the Entities. With Ogre, I did through all the nodes of the scene and cast the sons of the nodes to Entities (the code below is the one that did this):
But with Mogre I can't, as it give me an error when I try to cast a Node to an Entity. If someone can tell me how you can access to an Entity without knowing its name, it would be perfect,
Regards
My problem is this, I have access to an object mesh (which I think is made through an Entity). The fact is that I load the scene from a .scene file and I don't know the names of each of the Entities. With Ogre, I did through all the nodes of the scene and cast the sons of the nodes to Entities (the code below is the one that did this):
Ogre::Node::ChildNodeIterator iterator = scene->GetRootNode()->getChildIterator();
while(iterator.hasMoreElements()){
Ogre::SceneNode* child = (Ogre::SceneNode *)iterator.getNext();
Ogre::SceneNode::ObjectIterator oi = child->getAttachedObjectIterator();
child->setPosition(child->getPosition()*50);
child->translate(0,2400,0);
while(oi.hasMoreElements()){
Ogre::Entity* ent = (Ogre::Entity *)oi.getNext(); // This is the important line
// blablabla
}
}
But with Mogre I can't, as it give me an error when I try to cast a Node to an Entity. If someone can tell me how you can access to an Entity without knowing its name, it would be perfect,
Regards