avoid dividing by 0

This commit is contained in:
Chuyuan Fu 2019-10-29 14:40:36 -07:00 committed by Xuchen Han
parent ae7c3e0dee
commit 41eb074406

View File

@ -979,7 +979,7 @@ public:
btVector3 com(0, 0, 0);
for (int i = 0; i < m_nodes.size(); i++)
{
com += (m_nodes[i].m_x / m_nodes[i].m_im);
com += (m_nodes[i].m_x * this->getMass(i));
}
com /= this->getTotalMass();
return com;