Missing factor 2 in PSolve_RContacts (btSoftBody.cpp) ?

ole.k
Posts: 17
Joined: Thu Jun 12, 2008 1:32 pm

Missing factor 2 in PSolve_RContacts (btSoftBody.cpp) ?

Post by ole.k »

I'm just going through the softbody code. As I am particularly interested in how the soft/rigid-body-interaction is modelled, I had a closer look at PSolve_RContacts. I was wondering if there is a factor 2 missing in the line

const btVector3 impulse=c.m_c0*((vr-fv*c.m_c3+cti.m_normal*(dp*c.m_c4))*kst);

If I am right, for a (1-dimensional) elastic collision, the difference in impulse is 2(va - vb) / (1/ma+1/mb). va-vb is vr in the code, 1/(1/ma+1/mb) is c.m_c0. So I would expect a factor 2 in front of vr?
Nathanael
Posts: 78
Joined: Mon Nov 13, 2006 1:44 am

Re: Missing factor 2 in PSolve_RContacts (btSoftBody.cpp) ?

Post by Nathanael »

ole.k wrote:If I am right, for a (1-dimensional) elastic collision, the difference in impulse is 2(va - vb) / (1/ma+1/mb). va-vb is vr in the code, 1/(1/ma+1/mb) is c.m_c0. So I would expect a factor 2 in front of vr?
What is modeled here is inelastic collisions, through in line 1027 the term 'cti.m_normal*(dp*c.m_c4)' add momentum to correct penetration.
But may be adding a restitution term ( '1+restitution' instead of '2' ) could be interesting.

Hope it help, thanks for the feedback,
Nathanael.
ole.k
Posts: 17
Joined: Thu Jun 12, 2008 1:32 pm

Re: Missing factor 2 in PSolve_RContacts (btSoftBody.cpp) ?

Post by ole.k »

OK, thanks for the comment, so I was wrong. Yes, trying restitution could be interesting.

Ole