Choose a default 'safe' collision margin for very small convex collision shapes, in particular btBoxShape and btCylinderShape

and add some documentation in btConvexInternalShape.h
Thanks to Simon Lundmark for the suggestion

Fixes http://code.google.com/p/bullet/issues/detail?id=349
This commit is contained in:
erwin.coumans
2011-09-15 18:17:20 +00:00
parent a13d22dc84
commit 69a932f13e
6 changed files with 45 additions and 10 deletions

View File

@@ -83,6 +83,7 @@ public:
}
///a btBox2dShape is a flat 2D box in the X-Y plane (Z extents are zero)
btBox2dShape( const btVector3& boxHalfExtents)
: btPolyhedralConvexShape(),
m_centroid(0,0,0)
@@ -97,6 +98,11 @@ public:
m_normals[2].setValue(0,1,0);
m_normals[3].setValue(-1,0,0);
btScalar minDimension = boxHalfExtents.getX();
if (minDimension>boxHalfExtents.getY())
minDimension = boxHalfExtents.getY();
setSafeMargin(minDimension);
m_shapeType = BOX_2D_SHAPE_PROXYTYPE;
btVector3 margin(getMargin(),getMargin(),getMargin());
m_implicitShapeDimensions = (boxHalfExtents * m_localScaling) - margin;