move deformation update to before explicit force calculation to prevent repetition of F calculation

This commit is contained in:
Xuchen Han
2019-08-19 11:30:25 -07:00
parent 74adce7322
commit 54bd93aad2
4 changed files with 23 additions and 15 deletions

View File

@@ -2831,6 +2831,20 @@ void btSoftBody::initializeDmInverse()
}
}
void btSoftBody::updateDeformation()
{
for (int i = 0; i < m_tetras.size(); ++i)
{
btSoftBody::Tetra& t = m_tetras[i];
btVector3 c1 = t.m_n[1]->m_q - t.m_n[0]->m_q;
btVector3 c2 = t.m_n[2]->m_q - t.m_n[0]->m_q;
btVector3 c3 = t.m_n[3]->m_q - t.m_n[0]->m_q;
btMatrix3x3 Ds(c1.getX(), c2.getX(), c3.getX(),
c1.getY(), c2.getY(), c3.getY(),
c1.getZ(), c2.getZ(), c3.getZ());
t.m_F = Ds * t.m_Dm_inverse;
}
}
//
void btSoftBody::Joint::Prepare(btScalar dt, int)
{