Load B3D into Scene and add to TriangleSelector

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
xaddict
Posts: 23
Joined: Tue Jan 29, 2008 7:18 pm

Load B3D into Scene and add to TriangleSelector

Post by xaddict »

Hello,
I've changed the standard quake example to use my model and it looks quite nice but Now I want to add extra components (Houses, trees, etc.)

I'm using this code from the tutorial but it doesn't work... probably because I'm using AnimatedMesh and it is not an animated mesh... it doesn't load textures but they are where they should be...

Code: Select all

//add Flat
	scene::IAnimatedMesh* flatMesh = smgr->getMesh("../../media/Map/Story/FlatStory.b3d");
	scene::ISceneNode* flatNode = 0;

	if (flatMesh) flatNode = smgr->addOctTreeSceneNode(flatMesh->getMesh(0));
	flatNode->setScale(core::vector3df(.5,.5,.5));
	scene::ITriangleSelector* selector2 = 0;
	if (flatNode){
	flatNode->setPosition(core::vector3df(0,-200,0));
	selector2 = smgr->createOctTreeTriangleSelector(flatMesh->getMesh(0), flatNode, 128);
	flatNode->setTriangleSelector(selector2);}
I know this code is totally wrong for adding a static Mesh but I want to add this new mesh to the TriangleSelector and there is no clear example on how to add a mesh that is not Q3D (the tutorials all use the Q3D files and Archives)

Which is the shortest code to add a mesh (textured) to my scene (the textures are defined in the b3d file and in the same dir) and which is the shortest code to add all new meshes to my triangleselector?
Post Reply