Page 1 of 1

Performance issues with Bullet

Posted: Thu Jun 09, 2011 10:26 pm
by RageD
Hey everyone,

I feel like I am doing things improperly, so I am experiencing poor performance with bullet. I'm using the irrBullet wrapper to use bullet, but I am having difficulties loading the default quake mesh into bullet properly (or so I have read). It works if I use

Code: Select all

IGImpactMeshShape*
however, this is not very efficient (again, this is what I read - I read linked articles on optimization, etc.). Instead, I would like to use IBvhTriangleMeshShape*, however, I am getting an assertion error at line: 188 in the bullet source (btTriangleMeshShape.cpp). Perhaps I am doing something wrong? This is how I am trying to load in the map (everything is of correct type except it's a Q3Mesh):

Code: Select all

IBvhTriangleMeshShape * shape = new IBvhTriangleMeshShape(getLevelSceneNode(),
   getLevelMesh()->getMesh(0), 0.0);
In any case, this in and of itself does not cause any performance issue (on my slower machine, I can still run ~100FPS - on a good machine ~500-600FPS). However, what does cause issues is loading many enemies. I am not sure if this is the way to do it, but I am trying as follows:

Code: Select all

IGImpactMeshShape * shape = new IGImpactMeshShape(getNPCNode(),
  getNPCNode()->getMesh()->getMesh(0), 1.0);
That bit of code right there really kills everything - is this what I should do for mobile characters? Alternatively, I have tried this which does not negatively affect performance:

Code: Select all

ICollisionShape * shape = new IBoxShape(getNPCNode(), 1.0, false);
But it repositions the NPCs improperly.

Anyone have any ideas? Thanks.

-RageD

P.S.

That block of code in btTriangleMeshShape.cpp reads (line 188 is the assert):

Code: Select all

void	btTriangleMeshShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
{
	(void)mass;
	//moving concave objects not supported
	btAssert(0);
	inertia.setValue(btScalar(0.),btScalar(0.),btScalar(0.));
}
So I'm assuming that I shouldn't be here.