// you can call this function directly if you wish to use the same collision object for multiple rigid bodies,
// which will increase performance //
//--------------------------------------------------------------
void ofxBulletBaseShape::create( btDiscreteDynamicsWorld* a_world, btCollisionShape* a_colShape, btTransform &a_bt_tr, float a_mass ) {
	if(a_world == NULL) {
		ofLog(OF_LOG_ERROR, "ofxBulletSphere :: create : a_world param is NULL");
		return;
	}
	_mass			= a_mass;
	_world			= a_world;
	
	_bCreated		= true;
	
	_rigidBody		= ofGetBtRigidBodyFromCollisionShape( a_colShape, a_bt_tr, a_mass);
	setProperties(.4, .75);
	setDamping( .25 );
}
//--------------------------------------------------------------
void ofxBulletCustomShape::add() {
	_bAdded = true;
	btTransform trans;
	trans.setIdentity();
	
	for(int i = 0; i < centroids.size(); i++) {
		_centroid += centroids[i];
	}
	if(centroids.size() > 0)
		_centroid /= (float)centroids.size();
	btVector3 shiftCentroid;
	for(int i = 0; i < shapes.size(); i++) {
		shiftCentroid = btVector3(centroids[i].x, centroids[i].y, centroids[i].z);
		shiftCentroid -= btVector3(_centroid.x, _centroid.y, _centroid.z);
		trans.setOrigin( ( shiftCentroid ) );
		((btCompoundShape*)_shape)->addChildShape( trans, shapes[i]);
	}
	_rigidBody = ofGetBtRigidBodyFromCollisionShape( _shape, _startTrans, _mass);
	createInternalUserData();
	_world->addRigidBody(_rigidBody);
	setProperties(.4, .75);
	setDamping( .25 );
}