Ive already looked through the convexdecompositiondemo but im to stupid to understand it
Can you check if im doing this correctly and how do i make a rigid body from this and add it to the simulation?! IM LOST!!
Code: Select all
// i already have the trainglemesh setup
mTriMesh->addTriangle(v0, v1, v2, false);
btConvexShape* tmpConvexShape = new btConvexTriangleMeshShape(mTriMesh);
//create a hull approximation
btShapeHull* hull = new btShapeHull(tmpConvexShape);
btScalar margin = tmpConvexShape->getMargin();
hull->buildHull(margin);
tmpConvexShape->setUserPointer(hull);
btConvexHullShape* convexShape = new btConvexHullShape();
bool updateLocalAabb = false;
for (i=0;i<hull->numVertices();i++)
{
convexShape->addPoint(hull->getVertexPointer()[i],updateLocalAabb);
}
convexShape->recalcLocalAabb();
convexShape->initializePolyhedralFeatures();
delete tmpConvexShape;
delete hull;
bool useQuantization = true;
btCollisionShape* concaveShape = new btBvhTriangleMeshShape(mTriMesh,useQuantization);
startTransform.setOrigin(convexDecompositionObjectOffset);.
Now how do i make a rigid body from this and add it to the dynamics world!