I have discovered that my tickcallback is unstable in 2.75 and works perfectly fine with 2.73.
In 2.75 i get sometimes huge contact numbers back > 65000 or = max Int , which should be normaly below <10.
Right after this my userPointers in my collisionObject seem to be invalid. I can't even catch them since they seem to be pointing somewhere.
Same code works fine with 2.73 and none of these issues are present.
I am using more than 3000 Rigidbodies and more than 3000 Constraints.
Did something changed in 2.75 ? I might be missing something.
I debugged my own code and i can't see anything wrong, in addition it works fine with 2.73.
Any suggestions or tips ?
Code: Select all
static void myTickCallBack(btDynamicsWorld *world, btScalar timeStep ){
int numManifolds = world->getDispatcher()->getNumManifolds();
fxDynSolver *mySolver=NULL;
mySolver=static_cast<fxDynSolver*>(world->getWorldUserInfo());
if(mySolver!=NULL){
mySolver->simulate();
}
for (unsigned int i=0;i<numManifolds;i++){
btPersistentManifold* contactManifold = NULL;
contactManifold=world->getDispatcher()->getManifoldByIndexInternal(i);
btCollisionObject* obA = NULL;
if(contactManifold!=NULL)
obA=static_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = NULL;
if(contactManifold!=NULL)
obB=static_cast<btCollisionObject*>(contactManifold->getBody1());
unsigned int numContacts = 0;
if(contactManifold!=NULL)
numContacts=contactManifold->getNumContacts(); // <- numContacts returned are sometimes max Int value
fxDynRigidBody *bodyA=NULL;
fxDynRigidBody *bodyB=NULL;
if((numContacts>0)&&(obA!=NULL)&&(obB!=NULL)){
bodyA = static_cast<fxDynRigidBody*>(obA->getUserPointer()); // <- userPointer is invalid, after numContacts are insanely high
bodyB = static_cast<fxDynRigidBody*>(obB->getUserPointer());
if((bodyA!=NULL)&&(bodyB!=NULL))
if((bodyA->isDisabled() == false) && (bodyB->isDisabled() == false) && (bodyB!=NULL)&&(bodyA!=NULL) ){
bodyA->addCollision();
if(bodyA->isStatic())
if(bodyA->isAutoActive()){
bodyA->enableActiveDynamics();
bodyA->notifyRigidPool();
}