Im using btKinematicCharacterController in some program, when controller colide with btStaticPlaneShape program fall in btKinematicClosestNotMeConvexResultCallback::addSingleResult(btCollisionWorld::LocalConvexResult&, bool) segmentation fault.
Here is modified function CharacterDemo::initPhysics() from Demos/CharacterDemo/CharacterDemo.cpp with problem
Code: Select all
void CharacterDemo::initPhysics()
{
m_collisionConfiguration = new btDefaultCollisionConfiguration();
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
btVector3 worldMin(-1000,-1000,-1000);
btVector3 worldMax(1000,1000,1000);
btAxisSweep3* sweepBP = new btAxisSweep3(worldMin,worldMax);
m_overlappingPairCache = sweepBP;
m_constraintSolver = new btSequentialImpulseConstraintSolver();
m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_overlappingPairCache,m_constraintSolver,m_collisionConfiguration);
#ifdef DYNAMIC_CHARACTER_CONTROLLER
m_character = new DynamicCharacterController ();
#else
btTransform startTransform;
startTransform.setIdentity ();
//startTransform.setOrigin (btVector3(0.0, 4.0, 0.0));
startTransform.setOrigin (btVector3(10.210098,-1.6433364,16.453260));
m_ghostObject = new btPairCachingGhostObject();
m_ghostObject->setWorldTransform(startTransform);
sweepBP->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
btScalar characterHeight=1.75;
btScalar characterWidth =1.75;
btConvexShape* capsule;
//capsule = new btBoxShape(btVector3(characterWidth, characterHeight, characterWidth));
capsule = new btCapsuleShape(characterWidth,characterHeight);
m_ghostObject->setCollisionShape (capsule);
m_ghostObject->setCollisionFlags (btCollisionObject::CF_CHARACTER_OBJECT);
btScalar stepHeight = btScalar(0.35);
m_character = new btKinematicCharacterController (m_ghostObject,capsule,stepHeight);
#endif
btCollisionShape* groundShape;
/** Box OK */
//groundShape = new btBoxShape(btVector3(50,3,50));
/** Trimesh OK*/
//btTriangleMesh* trimesh = new btTriangleMesh();
//trimesh->addTriangle(btVector3(-100, 0, -100), btVector3(100, 0, -100), btVector3(0, 0, 100));
//groundShape = new btBvhTriangleMeshShape(trimesh, true);
/** StaticPlane not OK */
groundShape = new btStaticPlaneShape(btVector3(0, 1, 0), 1); //fall
btTransform t2;
t2.setIdentity();
t2.setOrigin(btVector3(0, -10, 0));
m_collisionShapes.push_back(groundShape);
localCreateRigidBody(0, t2, groundShape);
///only collide with static for now (no interaction with dynamic objects)
m_dynamicsWorld->addCollisionObject(m_ghostObject,btBroadphaseProxy::CharacterFilter, btBroadphaseProxy::StaticFilter|btBroadphaseProxy::DefaultFilter);
m_dynamicsWorld->addAction(m_character);
///////////////
clientResetScene();
setCameraDistance(56.f);
}Thanks
(sorry for my english)