pybullet.createSoftBodyAnchor

This commit is contained in:
Erwin Coumans
2019-11-19 19:20:08 -08:00
parent 431a71ebad
commit 96deb42aa5
12 changed files with 370 additions and 45 deletions

View File

@@ -2496,7 +2496,8 @@ void btSoftBody::updateNormals()
btSoftBody::Face& f = m_faces[i];
const btVector3 n = btCross(f.m_n[1]->m_x - f.m_n[0]->m_x,
f.m_n[2]->m_x - f.m_n[0]->m_x);
f.m_normal = n.normalized();
f.m_normal = n;
f.m_normal.safeNormalize();
f.m_n[0]->m_n += n;
f.m_n[1]->m_n += n;
f.m_n[2]->m_n += n;
@@ -3306,7 +3307,10 @@ void btSoftBody::interpolateRenderMesh()
n.m_x.setZero();
for (int j = 0; j < 4; ++j)
{
n.m_x += m_renderNodesParents[i][j]->m_x * m_renderNodesInterpolationWeights[i][j];
if (m_renderNodesParents[i].size())
{
n.m_x += m_renderNodesParents[i][j]->m_x * m_renderNodesInterpolationWeights[i][j];
}
}
}
}