use createCollisionResponseAnimator() but 2 ITriangleSelectr

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
EVO_Nova
Posts: 5
Joined: Mon Nov 27, 2006 7:58 am

use createCollisionResponseAnimator() but 2 ITriangleSelectr

Post by EVO_Nova »

I try to use createCollisionResponseAnimator () but I have two ITriangleSelector * (the first parameter of this function) :
one for the terrain
another for the IAnimatedMeshSceneNode

what should i do because i would like both of them to have the collision response Should I combine them into some variable or should I call this function 2 times or any solutions ?

^_^
EVO_Nova
Posts: 5
Joined: Mon Nov 27, 2006 7:58 am

Post by EVO_Nova »

I found that calling the function again and again and againg with every IAnimatedMeshSceneNode is usable. But if I have hundred of IAnimatedMeshSceneNode, Do I have to call that function hundred times ?
^_^
CodeDog
Posts: 106
Joined: Sat Oct 07, 2006 8:00 pm
Location: CA. USA
Contact:

Post by CodeDog »

Use a scene::IMetaTriangleSelector*

Example:

Code: Select all

scene::IMetaTriangleSelector* metaselector = 0;
metaselector = smgr->createMetaTriangleSelector();
IAnimatedMesh* mBlock = smgr->getMesh("block.b3d");
int z = 1;
for(int y = 0; y < 8; y++)
{
	for(int x = 0; x < 9; x++)
	{
		IAnimatedMeshSceneNode* nBlock = smgr->addAnimatedMeshSceneNode(mBlock, 0, z);
		scene::ITriangleSelector* selector = 0;
		selector = smgr->createOctTreeTriangleSelector(mBlock->getMesh(0), nBlock, 128);
		metaselector->addTriangleSelector(selector);

		if (nBlock)
		{			
			//nBlock->setDebugDataVisible(true);
			nBlock->setMaterialFlag(EMF_LIGHTING, true);		
			nBlock->setPosition(vector3df((22*x)-72,(22*y)+16.5,0));					
			
		}
		z++;
		z++;//odd ids for the bit mask
	}
}
Post Reply