btCompoundShape performance hit (ragdoll hockey game)

Post Reply
nullterm
Posts: 3
Joined: Wed Feb 17, 2010 2:40 pm

btCompoundShape performance hit (ragdoll hockey game)

Post by nullterm » Sun Nov 10, 2019 7:49 am

I'm working on a ragdoll simulation for a hockey game. Having an issue with the hockey sticks. Being an L shape, I need a way to represent the concave shape in Bullet.

Originally, I am using two separate rigidbody boxes with a btGeneric6DofConstraint constraint. Works mostly okay except in some situations the two rigidbodies can separate under stress.

Now, I'm trying to use one rigidboy using two boxes in a compound shape. The problem is that the Bullet simulation time jumps from ~1ms to >10ms, which kills the framerate.

Are compound shapes performance friendly or should I be using another representation like a mesh?

User avatar
drleviathan
Posts: 555
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: btCompoundShape performance hit (ragdoll hockey game)

Post by drleviathan » Mon Nov 11, 2019 4:39 pm

My experience has been btCompoundShape is indeed performance friendly, so it would be a mystery as to why you see such a dramatic performance change. You should obtain detailed timing measurements of a step to see where it is all being spent. The easiest way to do this is to call CProfileManager::dumpAll() after the world->stepSimulation() which will print some verbose but readable stats to stdout showing time spent in various contexts of that call. I recommend calling dumpAll() only once on request, or only once every few seconds so the printout itself doesn't interfere with your framerate and also so it doesn't flood stdout.

This assumes your Bullet libs were NOT compiled with -DBT_NO_PROFILE. If they were then I think you can achieve the same results by manually calling CProfileManager::reset() before the stepSimulation() and CProfileManager::Increment_Frame_Counter() after it. And finally: CProfileManager::dumpAll() when you want to see the stats.

Post Reply