Bulk mode for adding objects

bmueller
Posts: 6
Joined: Tue Aug 25, 2009 10:39 am

Bulk mode for adding objects

Post by bmueller »

Is there a bulk mode for adding objects?

Currently the time for adding objects grows with each object I add. The times here are taken from the debug version of my current program on a iPhone (ms for adding 128 btBoxShapes to a world):

78.89799
119.02400
146.56900
177.49400
210.33800
296.58401

Seems that the time is wasted on updating the broad phase data structures for every object.
Is there a possibility to start a bulk-add?
Something like:

Code: Select all

dynamicWorld.startAdding();
for(int i=0; i<1000; i++)
{
 // add your objects here
}
dynamicWorld.stopAdding();
Where stopAdding() starts refreshing the broad phase data (sorting the environment etc.) only once for all objects?
garvek
Posts: 6
Joined: Tue Aug 25, 2009 10:26 pm

Re: Bulk mode for adding objects

Post by garvek »

Perhaps you could try btDbvtBroadphase instead of the default btAxisSweep3 ?

I read on the manual that it may be more efficient where insert / delete of elements matters.