BtShapeHull vertex reduction utility

From Physics Simulation Wiki

Jump to: navigation, search

btShapeHull vertex reduction utility

  • Convex meshes often have too many vertices. This slows down collision detection a lot, and there is usually no benefit in the unnecessary details. It is best to keep the number of vertices of a btConvexHullShape below 100. Here is a way to do this:


//	btConvexShape* originalConvexShape; is the original convexHullShape

	//create a hull approximation
	btShapeHull* hull = new btShapeHull(originalConvexShape);
	btScalar margin = originalConvexShape->getMargin();
	hull->buildHull(margin);
	btConvexHullShape* simplifiedConvexShape = new btConvexHullShape(hull->getVertexPointer(),hull->numVertices());

See also Bullet/Demos/ConvexDecompositionDemo for some example usage of btShapeHull.

Personal tools