I have a bug that i just can't fix , i would really appreciate your help.
I'm using bullet for a FPS ( using Ogre), this problem occurs on windows, linux, with release 2.80 && 2.79 of bullet.
I'm creating bullets like this:
Code: Select all
btPairCachingGhostObject * tirGhostObject =new btPairCachingGhostObject();
tirGhostObject->setWorldTransform(startTransform);
btScalar bulletDimension = 0.2f;
btConvexShape * capsule =new btBoxShape(btVector3(bulletDimension,bulletDimension,bulletDimension));
mPhysics->addCollisionShape(capsule);
tirGhostObject->setCollisionShape(capsule);
tirGhostObject->setCollisionFlags(btCollisionObject::CF_NO_CONTACT_RESPONSE);//|btCollisionObject::CF_NO_CONTACT_RESPONSE);
mPhysics->addCollisionObject(tirGhostObject, btBroadphaseProxy::SensorTrigger,//&btBroadphaseProxy::DefaultFilter,
btBroadphaseProxy::CharacterFilter);
Vector3 orientation(mShootNode->getOrientation().zAxis());
mPhysics->getBroadphase()->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
// This one ==========>
mPhysics->getDynamicsWorld()->addCollisionObject(tirGhostObject, btBroadphaseProxy::SensorTrigger,btBroadphaseProxy::CharacterFilter);
<=====================
mPhysics->getDynamicsWorld()->addAction(newTir->getPhysics());
My program randomly crashes (segmentation fault),when i add collision object to my discrete dynamic world (not at the moment when i add them, but after). Sometimes it happens after 10 bullets, sometimes after 3.
If i dont add them to the world (by not adding the line specified , there is no problems in my application
I've tried everything i know, does someone have an idea?