From 41eb0744068b3b254a3fd2afad59ecfbcdc4422d Mon Sep 17 00:00:00 2001 From: Chuyuan Fu Date: Tue, 29 Oct 2019 14:40:36 -0700 Subject: [PATCH] avoid dividing by 0 --- src/BulletSoftBody/btSoftBody.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BulletSoftBody/btSoftBody.h b/src/BulletSoftBody/btSoftBody.h index 5f0afc439..d894d5cf5 100644 --- a/src/BulletSoftBody/btSoftBody.h +++ b/src/BulletSoftBody/btSoftBody.h @@ -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;