Passing concave meshes into convex shapes.

steveh
Posts: 22
Joined: Mon Dec 19, 2005 3:15 pm

Passing concave meshes into convex shapes.

Post by steveh »

Hello,
I read in the help document it is possible to pass a concave mesh into the btConvexHullShape constuctor to make the rigid body collide like a convex hull. When I try this, my simulation (2 dynamic donuts) comes to a griding halt (one frame very 5 minutes) when they collide. It works fine if both of the objects are added as potentially more CPU intesive btGIMPACTMeshShape as concave shapes (over 100fps). I'm fairly sure I've added the mess correctly (see below). I've also tried adding the mesh as a btConvexTriangleMeshShape too. My basic premise it to make concave object collide like a convex object.

Any ideas why it's running so slowly?

Many thanks,

Steve.

tf32 is a "float"

for(i=0;i<m.GetNumFaces();i++){
m.GetFaceVertexPositions(i,v1,v2,v3);
pVertices[(i * 9) + 0] = v1.VX;
pVertices[(i * 9) + 1] = v1.VY;
pVertices[(i * 9) + 2] = v1.VZ;

pVertices[(i * 9) + 3] = v2.VX;
pVertices[(i * 9) + 4] = v2.VY;
pVertices[(i * 9) + 5] = v2.VZ;

pVertices[(i * 9) + 6] = v3.VX;
pVertices[(i * 9) + 7] = v3.VY;
pVertices[(i * 9) + 8] = v3.VZ;
}

pCollShape = new btConvexHullShape(pVertices,m.GetNumFaces() * 3,sizeof(tF32) * 3);
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

How many points are you passing to the convex hull shape? About 32 vertices or less would be best.

There is no acceleration structure for convex hull shapes that contain many vertices. That should be an off-line tool.

Thanks,
Erwin
steveh
Posts: 22
Joined: Mon Dec 19, 2005 3:15 pm

Post by steveh »

Erwin Coumans wrote:How many points are you passing to the convex hull shape? About 32 vertices or less would be best.

There is no acceleration structure for convex hull shapes that contain many vertices. That should be an off-line tool.

Thanks,
Erwin
Eek! About 1700 points! I thought it would make a convex hull out of it (that's what the User Manual insinuates on page 10).

Steve.
User avatar
projectileman
Posts: 109
Joined: Thu Dec 14, 2006 4:27 pm
Location: Colombia

Post by projectileman »

Also you can try the Bullet convex descomposition. Just take a look to the Demos and Extras folders.