Page 1 of 1

Need help with getting code to work IMesh to IAnimatedMesh?

Posted: Thu Dec 20, 2007 7:41 am
by kennypu666
Hi, I'm a beginner, and I was using this topic as a reference: http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=17247, and I just need to get the last part. ok, so I have the code:

Code: Select all

  //get the mesh name out
            stringc roommesh_name = attribs->getAttributeAsString("Mesh");
             
             attribs->drop();
             
             //get a mesh from name
             IMesh* roommesh = smgr->getMesh(roommesh_name.c_str())->getMesh(0);
             ITriangleSelector* selector = smgr->createOctTreeTriangleSelector( roommesh->getMesh(0),roommesh_node,128);
             roommesh_node->setTriangleSelector(selector);
             selector->drop();
and everypart works ok except at creating the ITriangleSelector. It gives the error 'class irr::scene::IMesh has no member named getMesh'. I know the problem is because roommesh is a IMesh, but how would I go about converting it into a IAnimatedMeshSceneNode, or just make the code work? Any help will be appreciated. Thanks in advance,
Ken

Posted: Thu Dec 20, 2007 9:26 am
by JP
Do this instead:

ITriangleSelector* selector = smgr->createOctTreeTriangleSelector( roommesh,roommesh_node,128);

You don't need roommesh->getMesh(0) because you already have an IMesh, which is what you want!

Posted: Thu Dec 20, 2007 6:36 pm
by kennypu666
!! it worked!! thanks for your help JP!!
Ken