Page 1 of 1

Loading a mesh

Posted: Mon Jan 28, 2008 3:08 am
by xfreakk
Hi i know theres examples for irrlicht but my questiong is very specific.
I want to load a mesh. Non Animated and certain coords x y z.
and have the mesh reload over and over again. Because the coords will be changing. This is to attach a skin to a networked player


heres my current mesh code but this isnt working

Code: Select all

scene::IAnimatedMesh* mesh = 0
	mesh = smgr->getMesh("../../../media/dwarf.x");
	scene::IAnimatedMeshSceneNode* anode = 0;

	anode = smgr->addAnimatedMeshSceneNode(mesh);
	anode->setPosition(core::vector3df(416,60,481));
	anode->setAnimationSpeed(15);

ive also tried

Code: Select all

void mesh(int x[],int y[], int z[])
{
	     video::IVideoDriver *driver;
     //ISceneNode* node;
     driver=device->getVideoDriver();
		video::SMaterial material;
	material.setTexture(0, driver->getTexture("../../../media/faerie2.bmp"));
	material.Lighting = true;

	scene::IAnimatedMeshSceneNode* node = 0;
	scene::IAnimatedMesh* faerie = smgr->getMesh("../../../media/faerie.md2");

	if (faerie)
	{
		node = smgr->addAnimatedMeshSceneNode(faerie);
		node->setPosition(core::vector3df(416,60,481));
		node->setMD2Animation(scene::EMAT_RUN);
		node->getMaterial(0) = material;

		node = smgr->addAnimatedMeshSceneNode(faerie);
		node->setPosition(core::vector3df(-70,0,-30));
		node->setMD2Animation(scene::EMAT_SALUTE);
		node->getMaterial(0) = material;

		node = smgr->addAnimatedMeshSceneNode(faerie);
		node->setPosition(core::vector3df(-70,0,-60));
		node->setMD2Animation(scene::EMAT_JUMP);
		node->getMaterial(0) = material;
	}

	material.setTexture(0, 0);
	material.Lighting = false;
}

Posted: Mon Jan 28, 2008 7:57 am
by Eigen
You wouldn't need to reload your mesh every frame just to change its position. Just use setPosition function like you've already done.

Better idea is to set the player model or whatever as the parent of the skin. Then it's attached and moves along with the body.