geting node by name
Posted: Wed Jun 17, 2009 6:45 pm
I have small question.How can i get scene node from irr file, by name?
thanks for answers
thanks for answers
Official forum of the Irrlicht Engine
https://irrlicht.sourceforge.io/forum/
Code: Select all
scene::ISceneNode * node = node;
scene::ITriangleSelector * selector = 0;
switch(smgr->getSceneNodeFromName(node->getName(), node))
{
case scene::"room":
selector = smgr->createTriangleSelector(((scene::IMeshSceneNode*)node)->getMesh(), node);
break;
wow, that's very bad, maybe (for sure) you should do some C/C++ research !?!?!koso wrote:OK i reduced my problems to one.and this is error:Code: Select all
scene::ISceneNode * node = node; scene::ITriangleSelector * selector = 0; switch(smgr->getSceneNodeFromName(node->getName(), node)) { case scene::"room": selector = smgr->createTriangleSelector(((scene::IMeshSceneNode*)node)->getMesh(), node); break;
main.cpp(105) : error C2450: switch expression of type 'irr::scene::ISceneNode *' is illegal
Help me please
Code: Select all
scene::ISceneNode * node = node;
Code: Select all
switch(smgr->getSceneNodeFromName(node->getName(), node))
Code: Select all
case scene::"room":
Code: Select all
// scene::ISceneNode * node = node; // wrong and not needed !!!
scene::ITriangleSelector * selector = 0;
if(core::stringc(node->getName()).equals_ignore_case("room"))
{
selector = smgr->createTriangleSelector(((scene::IMeshSceneNode*)node)->getMesh(), node);
}
i missed. i have nodes there.Acki wrote:
this is bad, you're using the same variable name two times, also why do you dublicate the node, having it once is enough !!!Code: Select all
scene::ISceneNode * node = /////node/////;
i missed. i have nodes there.Acki wrote:
this is bad, you're using the same variable name two times, also why do you dublicate the node, having it once is enough !!!Code: Select all
scene::ISceneNode * node = /////node/////;
and where do this nodes come from ???koso wrote:i missed. i have nodes there.
I thought so, but that doesn't change the fact that scene::"room" is illegal !!!koso wrote:and that "room" is name of node wich i want get from scene
and how did you get those nodes ???koso wrote:there are loop wich test all nodes in scene."nodes" is from that loop.
Code: Select all
scene::ITriangleSelector * selector = 0;
if(core::stringc(nodes[i]->getName()).equals_ignore_case("room"))
{
selector = smgr->createTriangleSelector(((scene::IMeshSceneNode*)nodes[i])->getMesh(), nodes[i]);
}