avoid dividing by 0

This commit is contained in:
Chuyuan Fu authored and Xuchen Han committed 2019-10-31 12:53:12 -07:00
1 parent ae7c3e0dee
commit 41eb074406
1 file changed
+1 -1
+1 -1
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;