apply patch for convex decomposition performance improvements, thanks to Tuan Kuranes:

http://code.google.com/p/bullet/issues/detail?id=199
Fix in soft body collision, adding collision margin twice (was visible when rigid body spheres rested on cloth)
This commit is contained in:
erwin.coumans
2009-02-28 00:21:30 +00:00
parent 93dd14dfff
commit a216ce4bf6
2 changed files with 27 additions and 5 deletions

View File

@@ -2176,9 +2176,15 @@ inline int maxdir(const T *p,int count,const T &dir)
{ {
assert(count); assert(count);
int m=0; int m=0;
float currDotm = dot(p[0], dir);
for(int i=1;i<count;i++) for(int i=1;i<count;i++)
{ {
if(dot(p[i],dir)>dot(p[m],dir)) m=i; const float currDoti = dot(p[i], dir);
if(currDoti > currDotm)
{
currDotm = currDoti;
m=i;
}
} }
return m; return m;
} }
@@ -2189,9 +2195,25 @@ int maxdirfiltered(const T *p,int count,const T &dir,Array<int> &allow)
{ {
assert(count); assert(count);
int m=-1; int m=-1;
for(int i=0;i<count;i++) if(allow[i]) float currDotm = dot(p[0], dir);
for(int i=0;i<count;i++)
{ {
if(m==-1 || dot(p[i],dir)>dot(p[m],dir)) m=i; if(allow[i])
{
if(m==-1 )
{
m=i;
}
else
{
const float currDoti = dot(p[i], dir);
if (currDoti>currDotm)
{
currDotm = currDoti;
m=i;
}
}
}
} }
assert(m!=-1); assert(m!=-1);
return m; return m;

View File

@@ -743,8 +743,8 @@ struct btSoftColliders
psb = ps; psb = ps;
m_colObj = colOb; m_colObj = colOb;
idt = ps->m_sst.isdt; idt = ps->m_sst.isdt;
margin = m_colObj->getCollisionShape()->getMargin()+ margin = m_colObj->getCollisionShape()->getMargin();
m_colObj->getCollisionShape()->getMargin(); ///Bullet rigid body uses multiply instead of minimum to determine combined friction. Some customization would be useful.
friction = btMin(psb->m_cfg.kDF,m_colObj->getFriction()); friction = btMin(psb->m_cfg.kDF,m_colObj->getFriction());
btVector3 mins; btVector3 mins;
btVector3 maxs; btVector3 maxs;