I have a simple question: How do I convert a btConvexShape
to a btSoftBody
? By using btSoftBodyHelpers::CreateFromConvexHull
? If so, I'm not clear on how I pass the convex hull to the softbody helper based on bullets documentation for the helper and convex shape
Asked
Active
Viewed 179 times
0

ipburbank
- 151
- 1
- 8
1 Answers
0
btConvexShape can be any convex object in bullet, not just a convex hull. You should implement different approaches depending on the concrete subclass. Use btCollisionShape::getShapeType() (return values) to find out the concrete implementation, then cast. Eg:
btSoftBody* convexShapeToSoft(const btConvexShape& shape)
{
if(shape.getShapeType() == BOX_SHAPE_PROXYTYPE)
{
const btBoxShape& boxShape = static_cast<const btBoxShape&>(shape);
// Build btSoftBody using the box vertices
}
else if(shape.getShapeType() == SPHERE_SHAPE_PROXYTYPE)
{
const btSphereShape& shpereShape = static_cast<const btSphereShape&>(shape);
// Build btSoftBody using the box vertices
}
// ....
}

Shank
- 330
- 2
- 4