DISABLE_SIMULATION with objects
Posted: Tue Dec 16, 2008 8:54 am
Hello everybody. I have a 3d scene with objects in an iPhone game. All objects have a rigid body with 1.0 mass and a (0,0,0) gravity system so the objects move free.
Each 2 seconds I duplicate an object (so all are same size, not very big), set status to ACTIVE_TAG and add to the scene with an impulse (applyImpulse or setLinearVelocity, I´ve tried both)
Some duplicated objects change to status DISABLE_SIMULATION in a random point of the execution. I´ve traced the code and found the point where status is changed, in Bullet´s btCollisionWorld::updateAabbs():
Not an expert in Bullet but it seems like some kind of problem in bullet. What is this and how can I solve it?? My objects aren´t too big.
I´m looking for memory leaks in my code that could cause a problem but any help will be much appreciated.
PD: I´m using Bullet 2.73.
Thanks!
Each 2 seconds I duplicate an object (so all are same size, not very big), set status to ACTIVE_TAG and add to the scene with an impulse (applyImpulse or setLinearVelocity, I´ve tried both)
Some duplicated objects change to status DISABLE_SIMULATION in a random point of the execution. I´ve traced the code and found the point where status is changed, in Bullet´s btCollisionWorld::updateAabbs():
Code: Select all
BT_PROFILE("updateAabbs");
btTransform predictedTrans;
for ( int i=0;i<m_collisionObjects.size();i++)
{
btCollisionObject* colObj = m_collisionObjects[i];
//only update aabb of active objects
if (colObj->isActive())
{
btVector3 minAabb,maxAabb;
colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
//need to increase the aabb for contact thresholds
btVector3 contactThreshold(gContactBreakingThreshold,gContactBreakingThreshold,gContactBreakingThreshold);
minAabb -= contactThreshold;
maxAabb += contactThreshold;
btBroadphaseInterface* bp = (btBroadphaseInterface*)m_broadphasePairCache;
//moving objects should be moderately sized, probably something wrong if not
if ( colObj->isStaticObject() || ((maxAabb-minAabb).length2() < btScalar(1e12)))
{
bp->setAabb(colObj->getBroadphaseHandle(),minAabb,maxAabb, m_dispatcher1);
} else
{
//something went wrong, investigate
//this assert is unwanted in 3D modelers (danger of loosing work)
colObj->setActivationState(DISABLE_SIMULATION); <- This is the place
static bool reportMe = true;
if (reportMe && m_debugDrawer)
{
reportMe = false;
m_debugDrawer->reportErrorWarning("Overflow in AABB, object removed from simulation");
m_debugDrawer->reportErrorWarning("If you can reproduce this, please email bugs@continuousphysics.com\n");
m_debugDrawer->reportErrorWarning("Please include above information, your Platform, version of OS.\n");
m_debugDrawer->reportErrorWarning("Thanks.\n");
}
}
}
}
I´m looking for memory leaks in my code that could cause a problem but any help will be much appreciated.
PD: I´m using Bullet 2.73.
Thanks!