diff --git a/Extras/ConvexDecomposition/cd_hull.cpp b/Extras/ConvexDecomposition/cd_hull.cpp index 38d1f74b4..7f1ac971b 100644 --- a/Extras/ConvexDecomposition/cd_hull.cpp +++ b/Extras/ConvexDecomposition/cd_hull.cpp @@ -2176,9 +2176,15 @@ inline int maxdir(const T *p,int count,const T &dir) { assert(count); int m=0; + float currDotm = dot(p[0], dir); for(int i=1;idot(p[m],dir)) m=i; + const float currDoti = dot(p[i], dir); + if(currDoti > currDotm) + { + currDotm = currDoti; + m=i; + } } return m; } @@ -2189,9 +2195,25 @@ int maxdirfiltered(const T *p,int count,const T &dir,Array &allow) { assert(count); int m=-1; - for(int i=0;idot(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); return m; diff --git a/src/BulletSoftBody/btSoftBodyInternals.h b/src/BulletSoftBody/btSoftBodyInternals.h index dc8dc398f..16c76e3f0 100644 --- a/src/BulletSoftBody/btSoftBodyInternals.h +++ b/src/BulletSoftBody/btSoftBodyInternals.h @@ -743,8 +743,8 @@ struct btSoftColliders psb = ps; m_colObj = colOb; idt = ps->m_sst.isdt; - margin = m_colObj->getCollisionShape()->getMargin()+ - m_colObj->getCollisionShape()->getMargin(); + margin = 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()); btVector3 mins; btVector3 maxs;