assertion in Gimpact collision objects with constraints

Post Reply
Moose
Posts: 31
Joined: Mon Nov 04, 2013 10:58 am

assertion in Gimpact collision objects with constraints

Post by Moose »

Hello,

I'm running Gimpact here for concave triangle meshes. So far with success and I like the results.
However, when I have a collision of two if those objects caused by a constraint I get an assertion.

I have two test cases.

a) A cone shaped static Gimpact mesh with a hinge that lets a dynamic torus fall onto the cone
b) A slider that lets the torus slide onto the cone vertically when a 6dof constraint pulls it towards the cone

In both cases the assertion occurs at the exact moment the objects would collide if they weren't concave. In Debug builds bullet throws the assertion right away. In Release builds the software continues to run but crashes after a few more seconds. This is vc90 on windows 64 bit build of stock bullet 2.82.

Here's the call stack:

> physik_bullet-d_1.dll!btVector3::normalize() Line 300 + 0x25 bytes C++
physik_bullet-d_1.dll!btPrimitiveTriangle::buildTriPlane() Line 91 C++
physik_bullet-d_1.dll!btGImpactCollisionAlgorithm::collide_sat_triangles(const btCollisionObjectWrapper * body0Wrap=0x0000000013e0dd78, const btCollisionObjectWrapper * body1Wrap=0x0000000013e0ddb8, const btGImpactMeshShapePart * shape0=0x0000000010594e40, const btGImpactMeshShapePart * shape1=0x000000001253ce40, const int * pairs=0x000000001075fff0, int pair_count=5685) Line 427 C++
physik_bullet-d_1.dll!btGImpactCollisionAlgorithm::gimpact_vs_gimpact(const btCollisionObjectWrapper * body0Wrap=0x0000000013e0dd78, const btCollisionObjectWrapper * body1Wrap=0x0000000013e0ddb8, const btGImpactShapeInterface * shape0=0x0000000010594e40, const btGImpactShapeInterface * shape1=0x000000001253ce40) Line 515 + 0x59 bytes C++
physik_bullet-d_1.dll!btGImpactCollisionAlgorithm::gimpact_vs_gimpact(const btCollisionObjectWrapper * body0Wrap=0x0000000013e0dd78, const btCollisionObjectWrapper * body1Wrap=0x0000000013e0ddb8, const btGImpactShapeInterface * shape0=0x0000000010594e40, const btGImpactShapeInterface * shape1=0x0000000012558e90) Line 491 C++
physik_bullet-d_1.dll!btGImpactCollisionAlgorithm::gimpact_vs_gimpact(const btCollisionObjectWrapper * body0Wrap=0x0000000013e0dd78, const btCollisionObjectWrapper * body1Wrap=0x0000000013e0ddb8, const btGImpactShapeInterface * shape0=0x0000000010664e90, const btGImpactShapeInterface * shape1=0x0000000012558e90) Line 476 C++
physik_bullet-d_1.dll!btGImpactCollisionAlgorithm::processCollision(const btCollisionObjectWrapper * body0Wrap=0x0000000013e0dd78, const btCollisionObjectWrapper * body1Wrap=0x0000000013e0ddb8, const btDispatcherInfo & dispatchInfo={...}, btManifoldResult * resultOut=0x0000000013e0e9d8) Line 889 C++
physik_bullet-d_1.dll!btCompoundCompoundLeafCallback::Process(const btDbvtNode * leaf0=0x0000000010731f90, const btDbvtNode * leaf1=0x000000001250ef90) Line 210 C++
physik_bullet-d_1.dll!MycollideTT(const btDbvtNode * root0=0x0000000010731f90, const btDbvtNode * root1=0x000000001250ef90, const btTransform & xform={...}, btCompoundCompoundLeafCallback * callback=0x0000000013e0e130) Line 280 C++
physik_bullet-d_1.dll!btCompoundCompoundCollisionAlgorithm::processCollision(const btCollisionObjectWrapper * body0Wrap=0x0000000013e0e958, const btCollisionObjectWrapper * body1Wrap=0x0000000013e0e998, const btDispatcherInfo & dispatchInfo={...}, btManifoldResult * resultOut=0x0000000013e0e9d8) Line 346 C++
physik_bullet-d_1.dll!btCollisionDispatcher::defaultNearCallback(btBroadphasePair & collisionPair={...}, btCollisionDispatcher & dispatcher={...}, const btDispatcherInfo & dispatchInfo={...}) Line 280 C++
physik_bullet-d_1.dll!btCollisionPairCallback::processOverlap(btBroadphasePair & pair={...}) Line 232 C++
physik_bullet-d_1.dll!btHashedOverlappingPairCache::processAllOverlappingPairs(btOverlapCallback * callback=0x0000000013e0eae8, btDispatcher * dispatcher=0x0000000007ad56f0) Line 387 + 0x15 bytes C++
physik_bullet-d_1.dll!btCollisionDispatcher::dispatchAllCollisionPairs(btOverlappingPairCache * pairCache=0x0000000007297f70, const btDispatcherInfo & dispatchInfo={...}, btDispatcher * dispatcher=0x0000000007ad56f0) Line 244 + 0x1a bytes C++
physik_bullet-d_1.dll!btCollisionWorld::performDiscreteCollisionDetection() Line 228 + 0x42 bytes C++
physik_bullet-d_1.dll!btDiscreteDynamicsWorld::internalSingleStepSimulation(double timeStep=0.016666666666666666) Line 494 C++
physik_bullet-d_1.dll!btDiscreteDynamicsWorld::stepSimulation(double timeStep=0.033333333333333333, int maxSubSteps=100, double fixedTimeStep=0.016666666666666666) Line 453 C++

The problem appears to be:

SIMD_FORCE_INLINE void buildTriPlane()
{
btVector3 normal = (m_vertices[1]-m_vertices[0]).cross(m_vertices[2]-m_vertices[0]);
normal.normalize();
m_plane.setValue(normal[0],normal[1],normal[2],m_vertices[0].dot(normal));
}

in Gimpact/btTriangleShapeEx.h

normal gets 0. I suspect it is the direction and distance to the other object..?

Anyway, is there any chance for a fix?

Cheers,
Moose
Post Reply