At some point in my project i need to update the shapes of some btCollisionObject and after all btCollisionShape have been updated i call bd_pWorld->performDiscreteCollisionDetection(), Collision Filters stay the same.
Now the Problem, my programm does not find any collisions between a objects with ShapeType btConvexHullShape and objects with ShapeType btBoxShape if the shape of the Object with the btBoxShape had its shape updated at some point in the program, collisions with objects that did not have their shapes updated at some point are detected correctly.
However, if i extract all vertices of the Box-Object and create a new ConvexHullShape with this information and replace the btCollisionShape of the Box-Object with the new ConvexHull, which was created using the btBoxShape, everything works just fine and all collisions are detected, but this needs much more time. So collisions between updated ConvesHullShapes are properly detected.
I implemented a Debug Drawer that shows collisions as Red dots, when i use the ConvexHullShape, collisions are displayed but if i use the btBoxShape nothing is displayed. I also tried out the contactpairTest function, same result.
I also tried using other CollisionShapes than the btBoxShape, for example: ConeShape; CylinderShape and ShpereShape, it seems that all of them are not recognized by the detection algorithm. Only the way using the convexhulls seems to work.
My Configuration:
Code: Select all
bd_pCollisionConfiguration = new btDefaultCollisionConfiguration();
bd_pDispatcher = new btCollisionDispatcher(bd_pCollisionConfiguration);
bd_pBroadphase = new btDbvtBroadphase();
bd_pWorld = new btCollisionWorld(bd_pDispatcher, bd_pBroadphase, bd_pCollisionConfiguration);
Function that updates the shape of the Box-Object
Code: Select all
void UpdateBoxShape(){
btVector3 mCurrent_Half_Extends_MV = btVector3(2,2,2);
btBoxShape* BoxShape= new btBoxShape(mCurrent_Half_Extends_MV);
btVector3 vertice = btVector3(0,0,0);
/* This is where i extract the vertice data from the previously build btBoxShape
btConvexHullShape* ConvexShape = new btConvexHullShape();
for (unsigned int vtx = 0; vtx < 8; vtx++){
BoxShape->getVertex(vtx, vertice);
ConvexShape->addPoint(vertice);
}
ConvexShape->recalcLocalAabb();
ConvexShape->initializePolyhedralFeatures();
*/
delete this->mMovement_Objects[0]->GetCollisionObject()->getCollisionShape();
this->mMovement_Objects[0]->GetCollisionObject()->setCollisionShape(BoxShape); // does not work!
this->mMovement_Objects[0]->GetCollisionObject()->setCollisionShape(ConvexShape); // works fine!
}
I dont know if someone has ever had this problem, but thanks in advance, i really hope that you guys can help me out here.