我有一个简单的问题:如何将btConvexShape转换为btSoftBody?通过使用btSoftBodyHelpers::CreateFromConvexHull?如果是这样的话,我不清楚如何根据helper和convex shape的bullets文档将凸包传递给softbody helper
发布于 2014-10-15 22:41:03
btConvexShape可以是bullet中的任何凸面对象,而不仅仅是凸面外壳。您应该根据具体的子类实现不同的方法。使用btCollisionShape::getShapeType() (return values)找出具体的实现,然后强制转换。例如:
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
}
// ....
}https://stackoverflow.com/questions/24377700
复制相似问题