name of a mesh with resultCallback.m_collisionObject

philT
Posts: 5
Joined: Wed Jun 02, 2010 1:34 pm

name of a mesh with resultCallback.m_collisionObject

Post by philT »

I want to import a .bullet scene with a lot of rigidbodys from maya : if (!fileLoader->loadFile("manyplanes.bullet"));
Now i want to check the name of each mesh that btCollisionWorld::rayTestSingle hits.
How to get the name of the mesh(rigidbody) from my resultCallback.m_collisionObject ?

thanks in advance
philT
Posts: 5
Joined: Wed Jun 02, 2010 1:34 pm

Re: name of a mesh with resultCallback.m_collisionObject

Post by philT »

i tried

Code: Select all

setupEmptyDynamicsWorld();
	
	btBulletWorldImporter* fileLoader = new btBulletWorldImporter(m_dynamicsWorld);
	//fileLoader->setVerboseMode(true);

	if (!fileLoader->loadFile("manyplanes.bullet"));

	
	int i;
	printf("Object Loaded with Name %d\n\n", m_dynamicsWorld->getNumCollisionObjects() ); 
	for (i=m_dynamicsWorld->getNumCollisionObjects()-1; i>=0 ;i--)
	{
		btCollisionObject* obj = m_dynamicsWorld->getCollisionObjectArray()[i];
		btRigidBody* body = btRigidBody::upcast(obj);
		const char* meshName = fileLoader->getNameForPointer(obj->getCollisionShape());
		printf("Object Loaded with Name %s\n\n", meshName );
			 
	}
but no success - sugestions are very appreciated
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: name of a mesh with resultCallback.m_collisionObject

Post by Erwin Coumans »