I load all meshes and use CompounedShape.
How it should look:
Convas (but I want to use BvhTriangleMeshShape):
Code: Select all
ConvexShape tmpConvexShape = new ConvexTriangleMeshShape(trimesh);
//create a hull approximation
ShapeHull hull = new ShapeHull(tmpConvexShape);
float margin = tmpConvexShape.Margin;
hull.BuildHull(margin);
tmpConvexShape.UserObject = hull;
ConvexHullShape convexShape = new ConvexHullShape();
foreach (Vector3 v in hull.Vertices)
{
convexShape.AddPoint(v);
}
convexShape.LocalScaling = new Vector3(0.25f, 0.25f, 0.25f);
tmpConvexShape.Dispose();
CollisionShapes.Add(convexShape);
Code: Select all
bool useQuantization = false;
CollisionShape concaveShape = new BvhTriangleMeshShape(trimesh, useQuantization);
CollisionShapes.Add(concaveShape);
Code: Select all
var cShape = new CompoundShape();
foreach (CollisionShape shape in CollisionShapes)
cShape.AddChildShape(Matrix.Identity, shape);
LocalCreateRigidBody(0, pos, cShape);