fixed btSoftBodyConcaveCollisionAlgorithm, wrong bounding box transformation

added vertex welding option for btTriangleMesh (brute-force slow)
reject appendFace for some degenerate triangles (all 3 vertices/nodes need to be different)
add setVelocity method for btSoftBody
This commit is contained in:
erwin.coumans
2008-09-26 21:59:03 +00:00
parent e0d1c1d057
commit 682a0a1b90
5 changed files with 99 additions and 72 deletions

View File

@@ -284,6 +284,13 @@ m_faces.push_back(f);
//
void btSoftBody::appendFace(int node0,int node1,int node2,Material* mat)
{
if (node0==node1)
return;
if (node1==node2)
return;
if (node2==node0)
return;
appendFace(-1,mat);
Face& f=m_faces[m_faces.size()-1];
btAssert(node0!=node1);
@@ -384,6 +391,20 @@ void btSoftBody::addVelocity(const btVector3& velocity)
for(int i=0,ni=m_nodes.size();i<ni;++i) addVelocity(velocity,i);
}
/* Set velocity for the entire body */
void btSoftBody::setVelocity( const btVector3& velocity)
{
for(int i=0,ni=m_nodes.size();i<ni;++i)
{
Node& n=m_nodes[i];
if(n.m_im>0)
{
n.m_v = velocity;
}
}
}
//
void btSoftBody::addVelocity(const btVector3& velocity,int node)
{