How to get mesh from a .irr scene?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
jameskayin
Posts: 5
Joined: Thu Mar 01, 2007 2:13 am

How to get mesh from a .irr scene?

Post by jameskayin »

That's a problem when I want to get a mesh from .irr scene.Here is the codes.

smgr->loadScene("anting.irr");
//=============================================
ISceneNode *scene_node=smgr->getSceneNodeFromName("rooms");
IAnimatedMesh *levelMesh=0;
if(scene_node && (scene_node->getType()==ESNT_MESH))
{
levelMesh=(IAnimatedMesh*)scene_node;
}
ISceneNode *levelNode=0;
if(levelMesh)
{
//The problem is here... :(
levelNode=smgr->addOctTreeSceneNode(levelMesh->getMesh(0));
}
//=============================================


Why can't I use "levelmesh->getMesh(0)" to get a mesh?Every time I execute this,the compiler occur an error.I have no idea,can someone give me a hand?
liger13
Posts: 119
Joined: Tue Jul 18, 2006 4:17 am

Post by liger13 »

you cant typecast a ISceneNode into an IAnimatedMesh.
youd have to typecast the scene_node to IAnimatedMeshSceneNode.
then you can use the getMesh() method.

also this might help :
http://irrlicht.sourceforge.net/phpBB2/ ... 47&start=0
although it goes through adding colission to the mesh, it also shows how to get the mesh in order to set the collision to it :)
jameskayin
Posts: 5
Joined: Thu Mar 01, 2007 2:13 am

Post by jameskayin »

Many thanks liger13,you are so kind :)
I'll try it.
Post Reply