Page 1 of 1

use createCollisionResponseAnimator() but 2 ITriangleSelectr

Posted: Wed Nov 29, 2006 3:13 am
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 ?

^_^

Posted: Wed Nov 29, 2006 3:21 am
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 ?
^_^

Posted: Wed Nov 29, 2006 4:05 am
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
	}
}