Code: Select all
btCollisionShape* collisionCheck::loadBCS(const char* filename, bool verbose) {
btBulletWorldImporter loader(0);//don't store info into the world
loader.setVerboseMode(verbose);
if (!loader.loadFile(filename)) return NULL;
btCollisionShape* shape = NULL;
if (loader.getNumCollisionShapes()>0) shape = loader.getCollisionShapeByIndex(0);
return shape;
}
Code: Select all
MyContactResultCallback crCallback;
btCollisionShape* shapeA= loadBCS("Models/Excalibur2_ABAxis.bcs");
btConvexShape* myCS= static_cast<btConvexShape*>(shapeA);
prevPtA.setOrigin(btVector3(-100, -200, -500));
btPtA.setOrigin(btVector3(-500, -200, -500));
if (prevPtA.getOrigin() != btPtA.getOrigin())
dynamicsWorld->convexSweepTest(myCS, prevPtA, btPtA, crCallback);
if (crCallback.hasHit()) {
cout << "Got a hit!";
}
I compared the difference between the simple sphere vs the loaded shape and found that when loading the shape, the collision shape type is int 31 vs. int 8 for simple sphere.
and so this line of code in btGjkPairDetector.cpp returns a very low negative number (don't make sense)
Code: Select all
btVector3 pInA = m_minkowskiA->localGetSupportVertexWithoutMarginNonVirtual(seperatingAxisInA);
Is it bad to cast btCollisionShape to btConvexShape? What's the correct way to use convexSweepTest with .bcs file?