Crash with btKinematicCharacterController and btGImpactShape

c.collomb
Posts: 1
Joined: Mon Nov 29, 2010 6:00 am

Crash with btKinematicCharacterController and btGImpactShape

Post by c.collomb »

Hi,

I am trying to use the character controller with a triangle soup, and when the first contact happens I have a crash deep down the following call stack

Basically m_floats is invalid in dot(), because the matrix reference passed to operator* is bad, this because m_hitCollisionObject is NULL in btKinematicClosestNotMeConvexResultCallback.
Simulation with other dynamic objects and the triangle soup are fine, just the character creates this crash.

I copied and pasted the code I extracted nearly identically to the sample provided.

Let me know if there is anything I can more to help,

Any help will be greatly appreciated.

Cedrick

====================================================
=== CHARACTER CODE NEARLY IDENTICAL TO PROVIDED SAMPLE ===
====================================================

btTransform startTransform;
startTransform.setIdentity();
startTransform.setOrigin( btVector3( 0.0, 10.0, 0.0 ) );

mGhostObject = new btPairCachingGhostObject();
mGhostObject->setWorldTransform( startTransform );
mpOverlappingPairCache->getOverlappingPairCache()->setInternalGhostPairCallback( new btGhostPairCallback() );

btScalar characterHeight = 2.0;
btScalar characterWidth = 1.5;
btConvexShape *capsule = new btCapsuleShape( characterWidth, characterHeight );
mGhostObject->setCollisionShape( capsule );
mGhostObject->setCollisionFlags( btCollisionObject::CF_CHARACTER_OBJECT );

btScalar stepHeight = btScalar( 0.35 );
mCharacter = new btKinematicCharacterController( mGhostObject, capsule, stepHeight );

mpDynamicsWorld->addCollisionObject( mGhostObject, btBroadphaseProxy::CharacterFilter, btBroadphaseProxy::StaticFilter | btBroadphaseProxy::DefaultFilter );
mpDynamicsWorld->addAction( mCharacter );

mpDynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs( mGhostObject->getBroadphaseHandle(), mpDynamicsWorld->getDispatcher() );
mCharacter->reset();
mCharacter->warp( startTransform.getOrigin() );

================
=== CALLSTACK ===
================

test.exe!btVector3::dot(const btVector3 & v={...}) Line 128 + 0x3 bytes C++
test.exe!operator*(const btMatrix3x3 & m={...}, const btVector3 & v={...}) Line 598 + 0x15 bytes C++
test.exe!btKinematicClosestNotMeConvexResultCallback::addSingleResult(btCollisionWorld::LocalConvexResult & convexResult={...}, bool normalInWorldSpace=false) Line 87 + 0x23 bytes C++
>test.exe!`btCollisionWorld::objectQuerySingle'::`25'::BridgeTriangleConvexcastCallback::reportHit(const btVector3 & hitNormalLocal=, const btVector3 & hitPointLocal=, float hitFraction=, int partId=, int triangleIndex=) Line 626 + 0x23 bytes C++
test.exe!btTriangleConvexcastCallback::processTriangle(btVector3 * triangle=, int partId=, int triangleIndex=) Line 171 + 0x2f bytes C++
test.exe!btGImpactMeshShapePart::processAllTriangles(btTriangleCallback * callback=, const btVector3 & aabbMin=, const btVector3 & aabbMax=) Line 170 + 0x2c bytes C++
test.exe!btGImpactMeshShape::processAllTriangles(btTriangleCallback * callback=0x0012da20, const btVector3 & aabbMin={...}, const btVector3 & aabbMax={...}) Line 181 + 0x32 bytes C++
test.exe!btCollisionWorld::objectQuerySingle(const btConvexShape * castShape=, const btTransform & convexFromTrans=, const btTransform & convexToTrans=, btCollisionObject * collisionObject=, const btCollisionShape * collisionShape=, const btTransform & colObjWorldTransform=, btCollisionWorld::ConvexResultCallback & resultCallback=, float allowedPenetration=) Line 644 + 0x2a bytes C++
test.exe!btGhostObject::convexSweepTest(const btConvexShape * castShape=, const btTransform & convexFromWorld=, const btTransform & convexToWorld=, btCollisionWorld::ConvexResultCallback & resultCallback=, float allowedCcdPenetration=) Line 139 + 0x3e bytes C++
test.exe!btKinematicCharacterController::stepDown(btCollisionWorld * collisionWorld=, float dt=) Line 418 C++
test.exe!btKinematicCharacterController::playerStep(btCollisionWorld * collisionWorld=, float dt=) Line 562 C++
test.exe!btKinematicCharacterController::updateAction(btCollisionWorld * collisionWorld=0x022c1970, float deltaTime=0.016666668) Line 102 + 0x1a bytes C++
test.exe!btDiscreteDynamicsWorld::updateActions(float timeStep=0.016666668) Line 437 + 0x31 bytes C++
test.exe!btDiscreteDynamicsWorld::internalSingleStepSimulation(float timeStep=0.016666668) Line 338 C++
test.exe!btDiscreteDynamicsWorld::stepSimulation(float timeStep=0.0040000002, int maxSubSteps=0x0000000a, float fixedTimeStep=0.016666668) Line 281 + 0x19 bytes C++
denisw
Posts: 2
Joined: Fri Aug 26, 2011 6:35 am

Re: Crash with btKinematicCharacterController and btGImpactS

Post by denisw »

Have you resolved the problem since? I am trying to integrate btKinematicCharacterController into the Blender Game Engine and am experiencing the exact same crashes.
denisw
Posts: 2
Joined: Fri Aug 26, 2011 6:35 am

Re: Crash with btKinematicCharacterController and btGImpactS

Post by denisw »

This is fixed in Bullet 2.78!