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?
Missing factor 2 in PSolve_RContacts (btSoftBody.cpp) ?
-
- Posts: 17
- Joined: Thu Jun 12, 2008 1:32 pm
-
- Posts: 78
- Joined: Mon Nov 13, 2006 1:44 am
Re: Missing factor 2 in PSolve_RContacts (btSoftBody.cpp) ?
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.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?
But may be adding a restitution term ( '1+restitution' instead of '2' ) could be interesting.
Hope it help, thanks for the feedback,
Nathanael.
-
- Posts: 17
- Joined: Thu Jun 12, 2008 1:32 pm
Re: Missing factor 2 in PSolve_RContacts (btSoftBody.cpp) ?
OK, thanks for the comment, so I was wrong. Yes, trying restitution could be interesting.
Ole
Ole